Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 23295 invoked from network); 11 Jun 2010 17:52:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Jun 2010 17:52:40 -0000 Received: (qmail 31478 invoked by uid 500); 11 Jun 2010 17:52:39 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 31379 invoked by uid 500); 11 Jun 2010 17:52:39 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 31350 invoked by uid 99); 11 Jun 2010 17:52:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 17:52:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 17:52:36 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o5BHqE8q015385 for ; Fri, 11 Jun 2010 17:52:15 GMT Message-ID: <9417919.47741276278734790.JavaMail.jira@thor> Date: Fri, 11 Jun 2010 13:52:14 -0400 (EDT) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1692) Add post creation callback to BrokerFactory In-Reply-To: <4876640.32541276207337695.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877883#action_12877883 ] Rick Curtis commented on OPENJPA-1692: -------------------------------------- My previous commit will regress OPENJPA-1491. Refactoring some code right now to take that problem into account. > Add post creation callback to BrokerFactory > ------------------------------------------- > > Key: OPENJPA-1692 > URL: https://issues.apache.org/jira/browse/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 (openjpa.InitializeEagerly=true). > 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 > if(InitializeEagerly==true) > 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){ > super(c); > // setup > _conf = c; > } > newBroker(){ > _conf.getSomething(); <-- _conf IS NULL because the constructor hasn't fully executed yet. > } > } > 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.