From dev-return-16750-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Thu Jul 01 15:21:46 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 53315 invoked from network); 1 Jul 2010 15:21:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jul 2010 15:21:45 -0000 Received: (qmail 1377 invoked by uid 500); 1 Jul 2010 15:21:45 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 1279 invoked by uid 500); 1 Jul 2010 15:21:44 -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 1264 invoked by uid 99); 1 Jul 2010 15:21:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 15:21:44 +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; Thu, 01 Jul 2010 15:21:42 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o61FDn3l028562 for ; Thu, 1 Jul 2010 15:13:49 GMT Message-ID: <22025180.154671277997229465.JavaMail.jira@thor> Date: Thu, 1 Jul 2010 11:13:49 -0400 (EDT) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (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:all-tabpanel ] Rick Curtis resolved OPENJPA-1692. ---------------------------------- Resolution: Fixed > 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 > Fix For: 2.1.0 > > > 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.