Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 8980 invoked from network); 28 Feb 2007 19:48:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Feb 2007 19:48:36 -0000 Received: (qmail 47027 invoked by uid 500); 28 Feb 2007 19:48:44 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 47000 invoked by uid 500); 28 Feb 2007 19:48:44 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 46991 invoked by uid 99); 28 Feb 2007 19:48:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 11:48:44 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of plinskey@bea.com designates 66.248.192.21 as permitted sender) Received: from [66.248.192.21] (HELO usremg01.bea.com) (66.248.192.21) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 11:48:33 -0800 Received: from usremr02.bea.com (usremr02.bea.com [10.160.29.92]) by usremg01.bea.com (Switch-3.2.2/Switch-3.2.2) with ESMTP id l1SJm3ZD012963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 28 Feb 2007 11:48:11 -0800 Received: from repbex02.amer.bea.com (repbex02.bea.com [10.160.26.99]) by usremr02.bea.com (Switch-3.2.2/Switch-3.2.2) with ESMTP id l1SJm1mv000702 for ; Wed, 28 Feb 2007 11:48:01 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: svn commit: r512906 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-project/src/doc/manual/ Date: Wed, 28 Feb 2007 11:47:56 -0800 Message-ID: <7D856CDFE035FF45A0420ACBD71BDD6303592FD3@repbex02.amer.bea.com> In-Reply-To: <4C79123A-3BC1-443A-93DF-EADE06118B54@bea.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: svn commit: r512906 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-project/src/doc/manual/ Thread-Index: AcdbcHy2MvIJOo7NTEyzZ6bRa2nhsgAAKGrg References: <20070228192053.436F61A981A@eris.apache.org> <4C79123A-3BC1-443A-93DF-EADE06118B54@bea.com> From: "Patrick Linskey" To: X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2007.2.21.151434 X-Virus-Checked: Checked by ClamAV on apache.org > Cloneable _templateBroker =3D null; > boolean _templateTried =3D false; > if (broker instanceof Cloneable) > _templateBroker =3D (Cloneable) broker; Since BrokerImpl is Cloneable, and the property always returns a BrokerImpl, I don't think that we need to check for cloneability. -Patrick --=20 Patrick Linskey BEA Systems, Inc.=20 _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.=20 > -----Original Message----- > From: Abe White=20 > Sent: Wednesday, February 28, 2007 11:41 AM > To: open-jpa-dev@incubator.apache.org > Subject: Re: svn commit: r512906 - in=20 > /incubator/openjpa/trunk:=20 > openjpa-kernel/src/main/java/org/apache/openjpa/conf/=20 > openjpa-kernel/src/main/java/org/apache/openjpa/kernel/=20 > openjpa-project/src/doc/manual/ >=20 >=20 > > + public Object newInstance(String clsName, Class type, =20 > > Configuration conf, > > + boolean fatal) { > > + if (BrokerImpl.class.getName().equals(clsName)) { > > + // This is not synchronized. If there are concurrent =20 > > invocations > > + // while _templateBroker is null, we'll just end up =20 > > with extra > > + // template brokers, which will get safely garbage =20 > > collected. > > + if (_templateBroker =3D=3D null) > > + _templateBroker =3D (BrokerImpl) super.newInstance( > > + clsName, type, conf, fatal); > > + try { > > + return _templateBroker.clone(); > > + } catch (CloneNotSupportedException e) { > > + throw new InternalException(e); > > + } > > + } else { > > + return super.newInstance(clsName, type, conf, fatal); > > + } > > + } > > +} >=20 > Don't we want FinalizingBrokerImpls to clone too? And possible =20 > subclasses? How about: >=20 > Cloneable _templateBroker =3D null; > boolean _templateTried =3D false; >=20 > ... >=20 > if (!_templateTried) { > Object broker =3D super.newInstance(clsName, type, conf, false); > if (broker instanceof Cloneable) > _templateBroker =3D (Cloneable) broker; > _templateTried =3D true; > } >=20 > if (_templateBroker !=3D null) { > return _templateBroker.clone... > } > return super.newInstance... >=20 > And for completeness we should set _templateTrid to false on set/=20 > setString. > ______________________________________________________________ > _________ > Notice: This email message, together with any attachments,=20 > may contain > information of BEA Systems, Inc., its subsidiaries and =20 > affiliated > entities, that may be confidential, proprietary, =20 > copyrighted and/or > legally privileged, and is intended solely for the use of the=20 > individual > or entity named in this message. If you are not the intended=20 > recipient, > and have received this message in error, please immediately=20 > return this > by email and then delete it. >=20