Thank you simone > -----Original Message----- > From: jBoss CVS Development [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 27, 2001 6:04 PM > To: [EMAIL PROTECTED] > Subject: [jBoss-Dev] CVS update: jboss/src/main/org/jboss/ejb/plugins > CMPPersistenceManager.java > > > User: simone > Date: 01/02/27 16:03:51 > > Modified: src/main/org/jboss/ejb/plugins > CMPPersistenceManager.java > Log: > Optimized findByPrimaryKey calls: if the bean is already in > the cache we return it immediately without calling the finder. > > Revision Changes Path > 1.17 +15 -2 > jboss/src/main/org/jboss/ejb/plugins/CMPPersistenceManager.java > > Index: CMPPersistenceManager.java > =================================================================== > RCS file: > /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/CMPP > ersistenceManager.java,v > retrieving revision 1.16 > retrieving revision 1.17 > diff -u -r1.16 -r1.17 > --- CMPPersistenceManager.java 2001/01/26 20:31:24 1.16 > +++ CMPPersistenceManager.java 2001/02/28 00:03:51 1.17 > @@ -42,7 +42,7 @@ > * > * @see <related> > * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> > -* @version $Revision: 1.16 $ > +* @version $Revision: 1.17 $ > */ > public class CMPPersistenceManager > implements EntityPersistenceManager { > @@ -252,12 +252,25 @@ > > public Object findEntity(Method finderMethod, Object[] > args, EntityEnterpriseContext ctx) > throws Exception { > + // For now only optimize fBPK > + if (finderMethod.getName().equals("findByPrimaryKey")) > + { > + Object key = ctx.getCacheKey(); > + if (key == null) > + { > + key = > ((EntityCache)con.getInstanceCache()).createCacheKey(args[0]); > + } > + if (con.getInstanceCache().isActive(key)) > + { > + return key; // Object is active -> it exists > -> no need to call finder > + } > + } > > // The store will find the entity and return the primaryKey > Object id = store.findEntity(finderMethod, args, ctx); > > // We return the cache key > - return ((EntityCache) > con.getInstanceCache()).createCacheKey(id); > + return ((EntityCache) > con.getInstanceCache()).createCacheKey(id); > } > > public Collection findEntities(Method finderMethod, > Object[] args, EntityEnterpriseContext ctx) > > > > --------------------------------------------------------------------- This message (including any attachments) contains confidential, proprietary or privileged information intended for a specific purpose and individual(s), and is protected by law. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. Any unauthorized disclosure, copying or distribution of any part of this message, or the taking of any unauthorized action based on it, is strictly prohibited.
