openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
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 19:47:56 GMT
> Cloneable _templateBroker = null;
> boolean _templateTried = false;

>      if (broker instanceof Cloneable)
>          _templateBroker = (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

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
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. 

> -----Original Message-----
> From: Abe White 
> Sent: Wednesday, February 28, 2007 11:41 AM
> To: open-jpa-dev@incubator.apache.org
> 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/
> 
> 
> > +    public Object newInstance(String clsName, Class type,  
> > Configuration conf,
> > +        boolean fatal) {
> > +        if (BrokerImpl.class.getName().equals(clsName)) {
> > +            // This is not synchronized. If there are concurrent  
> > invocations
> > +            // while _templateBroker is null, we'll just end up  
> > with extra
> > +            // template brokers, which will get safely garbage  
> > collected.
> > +            if (_templateBroker == null)
> > +                _templateBroker = (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);
> > +        }
> > +    }
> > +}
> 
> Don't we want FinalizingBrokerImpls to clone too?  And possible  
> subclasses?  How about:
> 
> Cloneable _templateBroker = null;
> boolean _templateTried = false;
> 
> ...
> 
> if (!_templateTried) {
>      Object broker = super.newInstance(clsName, type, conf, false);
>      if (broker instanceof Cloneable)
>          _templateBroker = (Cloneable) broker;
>      _templateTried = true;
> }
> 
> if (_templateBroker != null) {
>      return _templateBroker.clone...
> }
> return super.newInstance...
> 
> And for completeness we should set _templateTrid to false on set/ 
> setString.
> ______________________________________________________________
> _________
> 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.
> 

Mime
View raw message