openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <>
Subject [jira] Created: (OPENJPA-1692) Add post creation callback to BrokerFactory
Date Thu, 10 Jun 2010 22:02:17 GMT
Add post creation callback to BrokerFactory

                 Key: OPENJPA-1692
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.0.0, 2.1.0
            Reporter: Rick Curtis
            Assignee: Rick Curtis

There have been a couple instances (that come to my mind) where there was the need to do some
work after creating the broker factory. Sometimes there is a necessity to ensure single threadedness
@see (PersistenceProviderImpl.postBrokerFactoryInitialization(...)), other times we need to
perform some additional configuration / initialization after the BrokerFactory has completed

I recently ran across a problem with the second case. In AbstractBrokerFactory.ctor(...) we
attempt to create a broker even though the subclassed BrokerFactory hasn't able to execute
it's constructor.

Example pseudo code:

abstract class AbstractBrokerFactory {
	AbstractBrokerFactory(Config c){
		// setup
			this.newBroker(); <-- BAD! The subclass hasn't executed it's constructor but it may
be asked to create a new broker.

class ConcreteBrokerFactory extends AbstractBrokerFactory {
	Config _conf;
	ConcreteBrokerFactory (Config c){
		// setup
		_conf = c;
		_conf.getSomething(); <-- _conf IS NULL because the constructor hasn't fully executed

I propose that we need a postCreationCallBack method on the BrokerFactory interface. This
will be a single place that Bootstrap can drive this 'after creation ish' work.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message