[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: patriot1burke Date: 02/04/09 22:42:38 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: don't ctx.setTransaction is method is readonly or bean is readonly. Otherwise, Passivation thread could spin forever Revision ChangesPath 1.52 +8 -2 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- EntityInstanceInterceptor.java8 Mar 2002 08:12:45 - 1.51 +++ EntityInstanceInterceptor.java10 Apr 2002 05:42:38 - 1.52 @@ -40,7 +40,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.51 $ +* @version $Revision: 1.52 $ * * Revisions: * 2001/06/28: marcf @@ -172,7 +172,13 @@ // Associate transaction, in the new design the lock already has the transaction from the // previous interceptor - ctx.setTransaction(mi.getTransaction()); + + // Don't set the transction if a read-only method. With a read-only method, the ctx can be shared + // between multiple transactions. + if (!container.isReadOnly() && !container.getBeanMetaData().isMethodReadOnly(mi.getMethod().getName())) + { + ctx.setTransaction(mi.getTransaction()); + } // Set the current security information ctx.setPrincipal(mi.getPrincipal()); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityMultiInstanceInterceptor.java MessageDrivenInstanceInterceptor.java StatefulSessionInstanceInterceptor.java StatelessSessionInstanceInterceptor.java
User: ejort Date: 01/12/30 00:59:16 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityMultiInstanceInterceptor.java MessageDrivenInstanceInterceptor.java StatefulSessionInstanceInterceptor.java StatelessSessionInstanceInterceptor.java Log: Fixed the security unit tests. Revision ChangesPath 1.48 +43 -35 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- EntityInstanceInterceptor.java2001/12/19 05:39:24 1.47 +++ EntityInstanceInterceptor.java2001/12/30 08:59:15 1.48 @@ -19,6 +19,8 @@ import org.jboss.invocation.Invocation; import org.jboss.ejb.CacheKey; +import org.jboss.security.SecurityAssociation; + /** * The instance interceptors role is to acquire a context representing * the target object from the cache. @@ -40,7 +42,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.47 $ +* @version $Revision: 1.48 $ * * Revisions: * 2001/06/28: marcf @@ -112,37 +114,40 @@ { return container; } - + // Interceptor implementation -- - + public Object invokeHome(Invocation mi) throws Exception { // Get context EntityEnterpriseContext ctx = (EntityEnterpriseContext)((EntityContainer)getContainer()).getInstancePool().get(); - + // Pass it to the method invocation mi.setEnterpriseContext(ctx); - + // Give it the transaction ctx.setTransaction(mi.getTransaction()); - + + // Set the current security information + ctx.setPrincipal(SecurityAssociation.getPrincipal()); + // Invoke through interceptors Object rtn = getNext().invokeHome(mi); // Is the context now with an identity? in which case we need to insert if (ctx.getId() != null) { - + BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey()); - + lock.sync(); // lock all access to BeanLock - - try + + try { // marcf: possible race on creation and usage -// insert instance in cache, +// insert instance in cache, container.getInstanceCache().insert(ctx); - + } finally { @@ -153,38 +158,41 @@ //Do not send back to pools in any case, let the instance be GC'ed return rtn; } - + public Object invoke(Invocation mi) throws Exception { - + // The key CacheKey key = (CacheKey) mi.getId(); - + // The context EntityEnterpriseContext ctx = (EntityEnterpriseContext) container.getInstanceCache().get(key); - + boolean trace = log.isTraceEnabled(); if( trace ) log.trace("Begin invoke, key="+key); - - // Associate transaction, in the new design the lock already has the transaction from the + + // Associate transaction, in the new design the lock already has the transaction from the // previous interceptor ctx.setTransaction(mi.getTransaction()); - + + // Set the current security information + ctx.setPrincipal(SecurityAssociation.getPrincipal()); + // Set context on the method invocation mi.setEnterpriseContext(ctx); - + boolean exceptionThrown = false; - + try - { + { return getNext().invoke(mi); } catch (RemoteException e) { exceptionThrown = true; throw e; - } + } catch (RuntimeException e) { exceptionThrown = true; @@ -193,41 +201,41 @@ { exceptionThrown = true; throw e; - } + } finally { // ctx can be null if cache.get throws an Exception, for // example when activating a bean. if (ctx != null) - { - // If an exception has been thrown, -if (exceptionThrown &&
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java
User: mnf999 Date: 01/12/18 21:39:25 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java Log: Methodinvocation -> Invocation Revision ChangesPath 1.47 +6 -6 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- EntityInstanceInterceptor.java2001/11/24 20:43:22 1.46 +++ EntityInstanceInterceptor.java2001/12/19 05:39:24 1.47 @@ -16,7 +16,7 @@ import org.jboss.ejb.EnterpriseContext; import org.jboss.ejb.InstanceCache; import org.jboss.ejb.InstancePool; -import org.jboss.ejb.MethodInvocation; +import org.jboss.invocation.Invocation; import org.jboss.ejb.CacheKey; /** @@ -26,7 +26,7 @@ * This particular container interceptor implements pessimistic locking *on the transaction that is associated with the retrieved instance. If *there is a transaction associated with the target component and it is -*different from the transaction associated with the MethodInvocation +*different from the transaction associated with the Invocation *coming in then the policy is to wait for transactional commit. * * We also implement serialization of calls in here (this is a spec @@ -40,7 +40,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.46 $ +* @version $Revision: 1.47 $ * * Revisions: * 2001/06/28: marcf @@ -115,7 +115,7 @@ // Interceptor implementation -- - public Object invokeHome(MethodInvocation mi) + public Object invokeHome(Invocation mi) throws Exception { // Get context @@ -154,7 +154,7 @@ return rtn; } - public Object invoke(MethodInvocation mi) + public Object invoke(Invocation mi) throws Exception { @@ -215,7 +215,7 @@ } else if (ctx.getId() == null) { - // The key from the MethodInvocation still identifies the right cachekey + // The key from the Invocation still identifies the right cachekey container.getInstanceCache().remove(key); if( trace ) log.trace("Ending invoke, cache removal, ctx="+ctx); 1.8 +4 -4 jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java Index: EntityLockInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- EntityLockInterceptor.java2001/11/24 20:43:22 1.7 +++ EntityLockInterceptor.java2001/12/19 05:39:24 1.8 @@ -12,7 +12,7 @@ import org.jboss.ejb.BeanLock; import org.jboss.ejb.BeanLockManager; import org.jboss.ejb.EntityContainer; -import org.jboss.ejb.MethodInvocation; +import org.jboss.invocation.Invocation; import org.jboss.ejb.CacheKey; /** @@ -31,7 +31,7 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.7 $ +* @version $Revision: 1.8 $ * * Revisions: * 2001/07/30: marcf @@ -73,7 +73,7 @@ // Interceptor implementation -- - public Object invokeHome(MethodInvocation mi) + public Object invokeHome(Invocation mi) throws Exception { // Invoke through interceptors @@ -81,7 +81,7 @@ } - public Object invoke(MethodInvocation mi) + public Object invoke(Invocation mi) throws Exception { 1.4 +4 -4 jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java Index: EntityMultiInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EntityMultiInstanceInterceptor.java 2001/11/24 20:43:22 1.3 +++ EntityMultiInstanceInterceptor.java 2001/12/19 05:39:24 1.4 @@ -14,7 +14,7 @@ import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.ejb.Enterpris
Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java TxInterceptorBMT.java
The change to TxInterceptorBMT breaks MessageDrivenTxInterceptorBMT which uses associateThread and disassociateThread from TxManager. I'm not sure of the best way to fix this, if noone says anything in the next few hours I may roll back this change. Would anyone object if I added a depends task to the compile targets in 3.0 to make this kind of problem less likely to get committed? Thanks david jencks On 2001.10.21 12:17:07 -0400 Scott M Stark wrote: > User: starksm > Date: 01/10/21 09:17:07 > > Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_4 > EntityInstanceInterceptor.java > EntityLockInterceptor.java > EntityMultiInstanceInterceptor.java > TxInterceptorBMT.java > Log: > Change org.jboss.tm.TxManager to javax.transaction.TransactionManager > in > TxInterceptorBMT and remove all imports of TxManager. > > Revision ChangesPath > No revision > > > No revision > > > 1.30.2.5 +1 -2 >jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java > > Index: EntityInstanceInterceptor.java > === > RCS file: >/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v > retrieving revision 1.30.2.4 > retrieving revision 1.30.2.5 > diff -u -r1.30.2.4 -r1.30.2.5 > --- EntityInstanceInterceptor.java 2001/10/20 > 22:13:22 1.30.2.4 > +++ EntityInstanceInterceptor.java 2001/10/21 > 16:17:07 1.30.2.5 > @@ -34,7 +34,6 @@ >import org.jboss.ejb.CacheKey; >import org.jboss.logging.log4j.JBossCategory; >import org.jboss.metadata.EntityMetaData; > -import org.jboss.tm.TxManager; > >/** >* The instance interceptors role is to acquire a context representing > @@ -57,7 +56,7 @@ >* @author mailto:[EMAIL PROTECTED]";>Marc Fleury >* @author mailto:[EMAIL PROTECTED]";>Scott Stark >* @author mailto:[EMAIL PROTECTED]";>Bill Burke > -* @version $Revision: 1.30.2.4 $ > +* @version $Revision: 1.30.2.5 $ >* >* Revisions: >* 2001/06/28: marcf > > > > 1.5.4.3 +1 -2 >jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java > > Index: EntityLockInterceptor.java > === > RCS file: >/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v > retrieving revision 1.5.4.2 > retrieving revision 1.5.4.3 > diff -u -r1.5.4.2 -r1.5.4.3 > --- EntityLockInterceptor.java 2001/10/20 > 22:13:22 1.5.4.2 > +++ EntityLockInterceptor.java 2001/10/21 > 16:17:07 1.5.4.3 > @@ -32,7 +32,6 @@ >import org.jboss.ejb.CacheKey; >import org.jboss.logging.log4j.JBossCategory; >import org.jboss.metadata.EntityMetaData; > -import org.jboss.tm.TxManager; > >/** > * The lock interceptors role is to schedule thread wanting to invoke > method on a target bean > @@ -50,7 +49,7 @@ >* >* @author mailto:[EMAIL PROTECTED]";>Marc Fleury >* @author mailto:[EMAIL PROTECTED]";>Bill Burke > -* @version $Revision: 1.5.4.2 $ > +* @version $Revision: 1.5.4.3 $ >* >* Revisions: >* 2001/07/30: marcf > > > > 1.1.4.2 +1 -2 >jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java > > Index: EntityMultiInstanceInterceptor.java > === > RCS file: >/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java,v > retrieving revision 1.1.4.1 > retrieving revision 1.1.4.2 > diff -u -r1.1.4.1 -r1.1.4.2 > --- EntityMultiInstanceInterceptor.java 2001/09/04 > 01:51:07 1.1.4.1 > +++ EntityMultiInstanceInterceptor.java 2001/10/21 > 16:17:07 1.1.4.2 > @@ -38,7 +38,6 @@ >import org.jboss.ejb.CacheKey; >import org.jboss.logging.log4j.JBossCategory; >import org.jboss.metadata.EntityMetaData; > -import org.jboss.tm.TxManager; > >/** > * The instance interceptors role is to acquire a context representing > @@ -46,7 +45,7 @@ > * > * > * @author mailto:[EMAIL PROTECTED]";>Bill Burke > - * @version $Revision: 1.1.4.1 $ > + * @version $Revision: 1.1.4.2 $ > * > * Revisions: > * 2001/08/08: billb > > > > 1.16.4.2 +4 -4 jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java > > Index: TxInterceptorBMT.java > === > RCS file: >/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java,v > retrieving revision 1.16.4.1 > retrieving revision 1.16.4.2 > diff -u -r1.16.4.1 -r1.16.4.2 > --- TxInterceptorBMT.java 2001/10/20 22:13:22 1.16.4.1 > +++ TxInterceptorBMT.java 2001/10/21 16:17:07 1.16.
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java TxInterceptorBMT.java
User: starksm Date: 01/10/21 09:17:07 Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_4 EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java TxInterceptorBMT.java Log: Change org.jboss.tm.TxManager to javax.transaction.TransactionManager in TxInterceptorBMT and remove all imports of TxManager. Revision ChangesPath No revision No revision 1.30.2.5 +1 -2 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.30.2.4 retrieving revision 1.30.2.5 diff -u -r1.30.2.4 -r1.30.2.5 --- EntityInstanceInterceptor.java2001/10/20 22:13:22 1.30.2.4 +++ EntityInstanceInterceptor.java2001/10/21 16:17:07 1.30.2.5 @@ -34,7 +34,6 @@ import org.jboss.ejb.CacheKey; import org.jboss.logging.log4j.JBossCategory; import org.jboss.metadata.EntityMetaData; -import org.jboss.tm.TxManager; /** * The instance interceptors role is to acquire a context representing @@ -57,7 +56,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.30.2.4 $ +* @version $Revision: 1.30.2.5 $ * * Revisions: * 2001/06/28: marcf 1.5.4.3 +1 -2 jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java Index: EntityLockInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v retrieving revision 1.5.4.2 retrieving revision 1.5.4.3 diff -u -r1.5.4.2 -r1.5.4.3 --- EntityLockInterceptor.java2001/10/20 22:13:22 1.5.4.2 +++ EntityLockInterceptor.java2001/10/21 16:17:07 1.5.4.3 @@ -32,7 +32,6 @@ import org.jboss.ejb.CacheKey; import org.jboss.logging.log4j.JBossCategory; import org.jboss.metadata.EntityMetaData; -import org.jboss.tm.TxManager; /** * The lock interceptors role is to schedule thread wanting to invoke method on a target bean @@ -50,7 +49,7 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.5.4.2 $ +* @version $Revision: 1.5.4.3 $ * * Revisions: * 2001/07/30: marcf 1.1.4.2 +1 -2 jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java Index: EntityMultiInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -u -r1.1.4.1 -r1.1.4.2 --- EntityMultiInstanceInterceptor.java 2001/09/04 01:51:07 1.1.4.1 +++ EntityMultiInstanceInterceptor.java 2001/10/21 16:17:07 1.1.4.2 @@ -38,7 +38,6 @@ import org.jboss.ejb.CacheKey; import org.jboss.logging.log4j.JBossCategory; import org.jboss.metadata.EntityMetaData; -import org.jboss.tm.TxManager; /** * The instance interceptors role is to acquire a context representing @@ -46,7 +45,7 @@ * * * @author mailto:[EMAIL PROTECTED]";>Bill Burke - * @version $Revision: 1.1.4.1 $ + * @version $Revision: 1.1.4.2 $ * * Revisions: * 2001/08/08: billb 1.16.4.2 +4 -4 jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java Index: TxInterceptorBMT.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/TxInterceptorBMT.java,v retrieving revision 1.16.4.1 retrieving revision 1.16.4.2 diff -u -r1.16.4.1 -r1.16.4.2 --- TxInterceptorBMT.java 2001/10/20 22:13:22 1.16.4.1 +++ TxInterceptorBMT.java 2001/10/21 16:17:07 1.16.4.2 @@ -16,6 +16,7 @@ import javax.transaction.Status; import javax.transaction.Transaction; +import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; import javax.naming.Context; @@ -32,7 +33,6 @@ import org.jboss.ejb.StatefulSessionEnterpriseContext; import org.jboss.ejb.StatelessSessionEnterpriseContext; import org.jboss.ejb.MethodInvocation; -import org.jboss.tm.TxManager; import org.jboss.logging.Logger; import org.jboss.metadata.MetaData; @@ -48,7 +48,7 @@ * @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini * @author Peter Antman ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>Anatoly Akkerm
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceSynchronizationInterceptor.java StatelessSessionInstanceInterceptor.java TxInterceptorBMT.java
User: starksm Date: 01/10/20 15:13:22 Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_4 EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceSynchronizationInterceptor.java StatelessSessionInstanceInterceptor.java TxInterceptorBMT.java Log: Remove the unused javax.transaction.* imports. Revision ChangesPath No revision No revision 1.30.2.4 +1 -5 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.30.2.3 retrieving revision 1.30.2.4 diff -u -r1.30.2.3 -r1.30.2.4 --- EntityInstanceInterceptor.java2001/10/18 20:32:39 1.30.2.3 +++ EntityInstanceInterceptor.java2001/10/20 22:13:22 1.30.2.4 @@ -19,11 +19,7 @@ import javax.ejb.RemoveException; import javax.ejb.EntityBean; import javax.transaction.Status; -import javax.transaction.Synchronization; import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; import org.jboss.ejb.Container; import org.jboss.ejb.BeanLock; @@ -61,7 +57,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.30.2.3 $ +* @version $Revision: 1.30.2.4 $ * * Revisions: * 2001/06/28: marcf 1.5.4.2 +156 -162 jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java Index: EntityLockInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -u -r1.5.4.1 -r1.5.4.2 --- EntityLockInterceptor.java2001/09/04 01:51:07 1.5.4.1 +++ EntityLockInterceptor.java2001/10/20 22:13:22 1.5.4.2 @@ -1,162 +1,156 @@ -/* -* JBoss, the OpenSource J2EE webOS -* -* Distributable under LGPL license. -* See terms of license at gnu.org. -*/ -package org.jboss.ejb.plugins; - -import java.lang.reflect.Method; -import java.rmi.RemoteException; -import java.util.Map; -import java.util.HashMap; -import java.util.ArrayList; - -import javax.ejb.EJBObject; -import javax.ejb.CreateException; -import javax.ejb.EJBException; -import javax.ejb.NoSuchEntityException; -import javax.ejb.RemoveException; -import javax.ejb.EntityBean; -import javax.transaction.Status; -import javax.transaction.Synchronization; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; - -import org.jboss.ejb.Container; -import org.jboss.ejb.BeanLock; -import org.jboss.ejb.BeanLockManager; -import org.jboss.ejb.EntityContainer; -import org.jboss.ejb.EntityPersistenceManager; -import org.jboss.ejb.EntityEnterpriseContext; -import org.jboss.ejb.EnterpriseContext; -import org.jboss.ejb.InstanceCache; -import org.jboss.ejb.InstancePool; -import org.jboss.ejb.MethodInvocation; -import org.jboss.ejb.CacheKey; -import org.jboss.logging.log4j.JBossCategory; -import org.jboss.metadata.EntityMetaData; -import org.jboss.tm.TxManager; - -/** - * The lock interceptors role is to schedule thread wanting to invoke method on a target bean - * -* The policies for implementing scheduling (pessimistic locking etc) is implemented by pluggable -*locks -* -* We also implement serialization of calls in here (this is a spec -*requirement). This is a fine grained notify, notifyAll mechanism. We -*notify on ctx serialization locks and notifyAll on global transactional -*locks. -* -* WARNING: critical code, get approval from senior developers -*before changing. -* -* @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.5.4.1 $ -* -* Revisions: -* 2001/07/30: marcf -* -* Initial revision -* Factorization of the lock out of the context in cache -* The new locking is implement as "scheduling" in the lock which allows for pluggable locks -* -* 2001/08/07: billb -* -* Removed while loop and moved it to SimplePessimisticEJBLock where it belongs. -* -*/ -public class EntityLockInterceptor - extends AbstractInterceptor -{ - // Constants -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: patriot1burke Date: 01/08/07 11:34:11 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: removed unused code Revision ChangesPath 1.42 +124 -169 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- EntityInstanceInterceptor.java2001/08/03 17:15:44 1.41 +++ EntityInstanceInterceptor.java2001/08/07 18:34:11 1.42 @@ -61,7 +61,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke -* @version $Revision: 1.41 $ +* @version $Revision: 1.42 $ * * Revisions: * 2001/06/28: marcf @@ -107,202 +107,157 @@ * */ public class EntityInstanceInterceptor -extends AbstractInterceptor + extends AbstractInterceptor { - // Constants - + // Constants - - // Attributes + // Attributes - protected EntityContainer container; + protected EntityContainer container; - // Static + // Static /** Use a JBoss custom log4j category for trace level logging */ - static JBossCategory log = (JBossCategory) JBossCategory.getInstance(EntityInstanceInterceptor.class); + static JBossCategory log = (JBossCategory) JBossCategory.getInstance(EntityInstanceInterceptor.class); - // Constructors -- + // Constructors -- // Public - public void setContainer(Container container) - { - this.container = (EntityContainer)container; - } - - public Container getContainer() - { - return container; - } - - // Interceptor implementation -- - - public Object invokeHome(MethodInvocation mi) - throws Exception - { - // Get context - EntityEnterpriseContext ctx = (EntityEnterpriseContext)((EntityContainer)getContainer()).getInstancePool().get(); + public void setContainer(Container container) + { + this.container = (EntityContainer)container; + } + + public Container getContainer() + { + return container; + } + + // Interceptor implementation -- + + public Object invokeHome(MethodInvocation mi) + throws Exception + { + // Get context + EntityEnterpriseContext ctx = (EntityEnterpriseContext)((EntityContainer)getContainer()).getInstancePool().get(); // Pass it to the method invocation - mi.setEnterpriseContext(ctx); + mi.setEnterpriseContext(ctx); - // Give it the transaction - ctx.setTransaction(mi.getTransaction()); + // Give it the transaction + ctx.setTransaction(mi.getTransaction()); - try - { - // Invoke through interceptors - return getNext().invokeHome(mi); - } - finally - { + try + { + // Invoke through interceptors + return getNext().invokeHome(mi); + } + finally + { - // Is the context now with an identity? in which case we need to insert - if (ctx.getId() != null) - { + // Is the context now with an identity? in which case we need to insert + if (ctx.getId() != null) + { - BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey()); +BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey()); - lock.sync(); // lock all access to BeanLock +lock.sync(); // lock all access to BeanLock - try { +try {
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: mnf999 Date: 01/08/01 11:26:57 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: With the new Bill lock we can in fact factored the full locking mechanisms to a whole new interceptor with pluggable policies. This results in a GREATLY simplified design for this interceptor, just a few straightforward lines Revision ChangesPath 1.40 +258 -422 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- EntityInstanceInterceptor.java2001/07/17 04:37:32 1.39 +++ EntityInstanceInterceptor.java2001/08/01 18:26:57 1.40 @@ -1,9 +1,9 @@ /* - * JBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ +* JBoss, the OpenSource EJB server +* +* Distributable under LGPL license. +* See terms of license at gnu.org. +*/ package org.jboss.ejb.plugins; import java.lang.reflect.Method; @@ -26,6 +26,8 @@ import javax.transaction.SystemException; import org.jboss.ejb.Container; +import org.jboss.ejb.BeanLock; +import org.jboss.ejb.BeanLockManager; import org.jboss.ejb.EntityContainer; import org.jboss.ejb.EntityPersistenceManager; import org.jboss.ejb.EntityEnterpriseContext; @@ -36,438 +38,272 @@ import org.jboss.ejb.CacheKey; import org.jboss.logging.log4j.JBossCategory; import org.jboss.metadata.EntityMetaData; -import org.jboss.util.Sync; import org.jboss.tm.TxManager; /** - * The instance interceptors role is to acquire a context representing - * the target object from the cache. - * - * This particular container interceptor implements pessimistic locking - *on the transaction that is associated with the retrieved instance. If - *there is a transaction associated with the target component and it is - *different from the transaction associated with the MethodInvocation - *coming in then the policy is to wait for transactional commit. - * - * We also implement serialization of calls in here (this is a spec - *requirement). This is a fine grained notify, notifyAll mechanism. We - *notify on ctx serialization locks and notifyAll on global transactional - *locks. - * - * WARNING: critical code, get approval from senior developers - *before changing. - * - * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @author mailto:[EMAIL PROTECTED]";>Bill Burke - * @version $Revision: 1.39 $ - * - * Revisions: - * 2001/06/28: marcf - * - * Moved to new synchronization - * Pools are gone simple design - * two levels of syncrhonization with Tx and ctx - * remove busy wait from previous mechanisms - * - * 2001/07/11: starksm - * - * Fix a thread starvation problem due to incomplete condition notification - * Add support for trace level diagnositics - * - * 2001/07/12: starksm - * - * Handle a race condition when there is no ctx transaction - * - * - * 2001/07/16: billb - * - * Added wait(timeout) code, commented out so that we can easily turn it on - * when this new code is done with it's trial period. - * Fixed bug when ejbLoad threw an exception and threads waiting - * on TxLock did not get awakened. - * - * - */ +* The instance interceptors role is to acquire a context representing +* the target object from the cache. +* +* This particular container interceptor implements pessimistic locking +*on the transaction that is associated with the retrieved instance. If +*there is a transaction associated with the target component and it is +*different from the transaction associated with the MethodInvocation +*coming in then the policy is to wait for transactional commit. +* +* We also implement serialization of calls in here (this is a spec +*requirement). This is a fine grained notify, notifyAll mechanism. We +*notify on ctx serialization locks and notifyAll on global transactional +*locks. +* +* WARNING: critical code, get approval from senior developers +*before changing. +* +* @author mailto:[EMAIL PROTECTED]";>Marc Fleury +* @author mailto:[EMAIL PROTECTED]";>Scott Stark +* @author mailto:[EMAIL PROTECTED]";>Bill Burke +* @version $Revision: 1.40 $ +* +* Revisions: +* 2001/06/28: marcf +* +* Moved to new synchronization +* Pools are gone simple design +* two levels of syncrhonization with Tx and ctx +* remove busy wait from previous mechanisms +* +* 2
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: starksm Date: 01/07/17 23:11:38 Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_4 EntityInstanceInterceptor.java Log: Fix the busy wait on tx contention by adding a Thread.sleep(1) Reformat the code to clean up the indent mismatch Revision ChangesPath No revision No revision 1.30.2.1 +368 -362 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -u -r1.30 -r1.30.2.1 --- EntityInstanceInterceptor.java2001/06/15 23:37:05 1.30 +++ EntityInstanceInterceptor.java2001/07/18 06:11:38 1.30.2.1 @@ -1,9 +1,9 @@ /* -* JBoss, the OpenSource EJB server -* -* Distributable under LGPL license. -* See terms of license at gnu.org. -*/ + * JBoss, the OpenSource EJB server + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package org.jboss.ejb.plugins; import java.lang.reflect.Method; @@ -39,367 +39,373 @@ import org.jboss.util.Sync; /** -* This container acquires the given instance. -* -* @see -* @author Rickard Öberg ([EMAIL PROTECTED]) -* @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini -* @version $Revision: 1.30 $ -*/ + * This container acquires the given instance. + * + * @see + * @author Rickard Öberg ([EMAIL PROTECTED]) + * @author mailto:[EMAIL PROTECTED]";>Marc Fleury + * @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini + * @version $Revision: 1.30.2.1 $ + */ public class EntityInstanceInterceptor extends AbstractInterceptor { -// Constants - - -// Attributes -protected EntityContainer container; - -// Static - -// Constructors -- - -// Public -public void setContainer(Container container) -{ -this.container = (EntityContainer)container; -} - -public Container getContainer() -{ -return container; -} - -// Interceptor implementation -- -public Object invokeHome(MethodInvocation mi) -throws Exception -{ -// Get context -EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); -mi.setEnterpriseContext(ctx); - -// It is a new context for sure so we can lock it -ctx.lock(); - -try -{ -// Invoke through interceptors -return getNext().invokeHome(mi); -} finally -{ -// Always unlock, no matter what -ctx.unlock(); - -// Still free? Not free if create() was called successfully -if (ctx.getId() == null) + // Constants - + + // Attributes + protected EntityContainer container; + + // Static + + // Constructors -- + + // Public + public void setContainer(Container container) + { + this.container = (EntityContainer)container; + } + + public Container getContainer() + { + return container; + } + + // Interceptor implementation -- + public Object invokeHome(MethodInvocation mi) + throws Exception + { + // Get context + EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); + mi.setEnterpriseContext(ctx); + + // It is a new context for sure so we can lock it + ctx.lock(); + + try + { + // Invoke through interceptors + return getNext().invokeHome(mi); + } finally + { + // Always unlock, no matter what + ctx.unlock(); + + // Still free? Not free if create() was called successfully + if (ctx.getId() == null) + { +container.getInstancePool().free(ctx); + } + } + } + + public Object invoke(MethodInvocation mi) + throws Exception + { +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: starksm Date: 01/07/17 20:30:02 Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_2 EntityInstanceInterceptor.java Log: A simple workaround for the busy wait spin in the presence of tx contention Revision ChangesPath No revision No revision 1.28.2.2 +14 -10 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -u -r1.28.2.1 -r1.28.2.2 --- EntityInstanceInterceptor.java2001/07/17 03:26:50 1.28.2.1 +++ EntityInstanceInterceptor.java2001/07/18 03:30:02 1.28.2.2 @@ -45,10 +45,11 @@ * @author Rickard Öberg ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini - * @version $Revision: 1.28.2.1 $ + * @author mailto:[EMAIL PROTECTED]";>Scott Stark + * @version $Revision: 1.28.2.2 $ */ public class EntityInstanceInterceptor -extends AbstractInterceptor + extends AbstractInterceptor { // Constants - @@ -72,7 +73,7 @@ // Interceptor implementation -- public Object invokeHome(MethodInvocation mi) - throws Exception + throws Exception { // Get context EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); @@ -99,7 +100,7 @@ } public Object invoke(MethodInvocation mi) - throws Exception + throws Exception { // The id store is a CacheKey in the case of Entity CacheKey key = (CacheKey)mi.getId(); @@ -112,6 +113,7 @@ try { + boolean waitingOnTransaction = false; do { if (mi.getTransaction() != null && mi.getTransaction().getStatus() == Status.STATUS_MARKED_ROLLBACK) @@ -119,7 +121,10 @@ try { - + // Don't let contending thread spin on the cpu + if( waitingOnTransaction == true ) + Thread.sleep(1); + mutex.acquire(); // Get context @@ -133,17 +138,16 @@ { // Let's put the thread to sleep a lock release will wake the thread // Possible deadlock - Logger.debug("LOCKING-WAITING (TRANSACTION) for id "+ctx.getId()+" ctx.hash "+ctx.hashCode()+" tx:"+((tx == null) ? "null" : tx.toString())); - synchronized( tx ) - { - tx.wait(1000); - } + if( waitingOnTransaction == false ) + Logger.debug("LOCKING-WAITING (TRANSACTION) for id "+ctx.getId()+" ctx.hash "+ctx.hashCode()+" tx:"+((tx == null) ? "null" : tx.toString())); + waitingOnTransaction = true; // Try your luck again ctx = null; continue; } else { + waitingOnTransaction = false; // If we get here it's the right tx, or no tx if (!ctx.isLocked()) { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: patriot1burke Date: 01/07/16 21:37:32 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: Fixed bug when ejbLoad threw an exception and threads waiting on TxLock did not get awakened. Revision ChangesPath 1.39 +16 -2 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- EntityInstanceInterceptor.java2001/07/16 23:42:39 1.38 +++ EntityInstanceInterceptor.java2001/07/17 04:37:32 1.39 @@ -60,7 +60,7 @@ * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark * @author mailto:[EMAIL PROTECTED]";>Bill Burke - * @version $Revision: 1.38 $ + * @version $Revision: 1.39 $ * * Revisions: * 2001/06/28: marcf @@ -84,6 +84,9 @@ * * Added wait(timeout) code, commented out so that we can easily turn it on * when this new code is done with it's trial period. + * Fixed bug when ejbLoad threw an exception and threads waiting + * on TxLock did not get awakened. + * * */ public class EntityInstanceInterceptor @@ -382,7 +385,18 @@ // Discard instance // EJB 1.1 spec 12.3.1 container.getInstanceCache().remove(key); - if( trace ) + // Notify all those waiting on TxLock. Since this ctx is not TxSynchronized + // there is nobody else to wake up waiting threads. + if (ctx.getTransaction() != null + && ctx.getTransaction().equals(mi.getTransaction())) + { + ctx.setTransaction(null); + synchronized(ctx.getTxLock()) + { +ctx.getTxLock().notifyAll(); + } + } + if( trace ) log.trace("Ending invoke, exceptionThrown, ctx="+ctx); } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: starksm Date: 01/07/16 20:26:51 Modified:src/main/org/jboss/ejb/plugins Tag: Branch_2_2 EntityInstanceInterceptor.java Log: Add a simple wait(1000) to avoid the spin wait that currently exists in the presence of transcation contention. Revision ChangesPath No revision No revision 1.28.2.1 +273 -265 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.28 retrieving revision 1.28.2.1 diff -u -r1.28 -r1.28.2.1 --- EntityInstanceInterceptor.java2001/01/12 00:05:53 1.28 +++ EntityInstanceInterceptor.java2001/07/17 03:26:50 1.28.2.1 @@ -1,9 +1,9 @@ /* -* JBoss, the OpenSource EJB server -* -* Distributable under LGPL license. -* See terms of license at gnu.org. -*/ + * JBoss, the OpenSource EJB server + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package org.jboss.ejb.plugins; import java.lang.reflect.Method; @@ -39,272 +39,280 @@ import org.jboss.util.Sync; /** -* This container acquires the given instance. -* -* @see -* @author Rickard Öberg ([EMAIL PROTECTED]) -* @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini -* @version $Revision: 1.28 $ -*/ + * This container acquires the given instance. + * + * @see + * @author Rickard Öberg ([EMAIL PROTECTED]) + * @author mailto:[EMAIL PROTECTED]";>Marc Fleury + * @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini + * @version $Revision: 1.28.2.1 $ + */ public class EntityInstanceInterceptor extends AbstractInterceptor { -// Constants - - -// Attributes -protected EntityContainer container; - -// Static - -// Constructors -- - -// Public -public void setContainer(Container container) -{ -this.container = (EntityContainer)container; -} - -public Container getContainer() -{ -return container; -} - -// Interceptor implementation -- -public Object invokeHome(MethodInvocation mi) -throws Exception -{ -// Get context -EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); -mi.setEnterpriseContext(ctx); - -// It is a new context for sure so we can lock it -ctx.lock(); - -try -{ -// Invoke through interceptors -return getNext().invokeHome(mi); -} finally -{ -// Always unlock, no matter what -ctx.unlock(); - -// Still free? Not free if create() was called successfully -if (ctx.getId() == null) -{ -container.getInstancePool().free(ctx); -} -} -} - -public Object invoke(MethodInvocation mi) -throws Exception -{ -// The id store is a CacheKey in the case of Entity -CacheKey key = (CacheKey)mi.getId(); - -// Get cache -AbstractInstanceCache cache = (AbstractInstanceCache)container.getInstanceCache(); -Sync mutex = (Sync)cache.getLock(key); - -EnterpriseContext ctx = null; - -try -{ -do + // Constants - + + // Attributes + protected EntityContainer container; + + // Static + + // Constructors -- + + // Public + public void setContainer(Container container) + { + this.container = (EntityContainer)container; + } + + public Container getContainer() + { + return container; + } + + // Interceptor implementation -- + public Object invokeHome(MethodInvocation mi) + throws Exception + { + // Get context + EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); + mi.setEnterpriseContext(ctx); + + // It is a new context for sure s
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: patriot1burke Date: 01/07/16 16:42:39 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: Added code so that we can quickly enable wait with a timeout. With just wait() Transaction timeouts will never rollback and waiting threads. Revision ChangesPath 1.38 +42 -10 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- EntityInstanceInterceptor.java2001/07/13 21:50:26 1.37 +++ EntityInstanceInterceptor.java2001/07/16 23:42:39 1.38 @@ -37,6 +37,7 @@ import org.jboss.logging.log4j.JBossCategory; import org.jboss.metadata.EntityMetaData; import org.jboss.util.Sync; +import org.jboss.tm.TxManager; /** * The instance interceptors role is to acquire a context representing @@ -58,7 +59,8 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @version $Revision: 1.37 $ + * @author mailto:[EMAIL PROTECTED]";>Bill Burke + * @version $Revision: 1.38 $ * * Revisions: * 2001/06/28: marcf @@ -77,6 +79,12 @@ * * Handle a race condition when there is no ctx transaction * + * + * 2001/07/16: billb + * + * Added wait(timeout) code, commented out so that we can easily turn it on + * when this new code is done with it's trial period. + * */ public class EntityInstanceInterceptor extends AbstractInterceptor @@ -86,6 +94,7 @@ // Attributes protected EntityContainer container; + protected int timeout; // Static @@ -99,6 +108,18 @@ public void setContainer(Container container) { this.container = (EntityContainer)container; + timeout = 5000; + if (container.getTransactionManager() != null) + { + if (container.getTransactionManager() instanceof TxManager) + { +TxManager mgr = (TxManager)container.getTransactionManager(); +timeout = (mgr.getDefaultTransactionTimeout() * 1000) + 50; + } + } + boolean trace = log.isTraceEnabled(); + if ( trace ) + log.trace("wait timeout = " + timeout); } public Container getContainer() @@ -158,6 +179,15 @@ log.trace("Begin invoke, key="+key); while (ctx == null) { + // Maybe my transaction already expired? This must be at the top of the loop. + Transaction miTx = mi.getTransaction(); + if (miTx != null && miTx.getStatus() == Status.STATUS_MARKED_ROLLBACK) + { +log.error("Saw rolled back tx="+miTx); +throw new RuntimeException("Transaction marked for rollback, possibly a timeout"); + } + + // Ok, get moving... ctx = (EntityEnterpriseContext) container.getInstanceCache().get(key); if( trace ) log.trace("Begin while ctx==null, ctx="+ctx); @@ -183,11 +213,18 @@ // Wait for it to finish, note that we use wait() and not wait(5000), why? // cause we got cojones, if there a problem in this code we want a freeze not illusion // Threads finishing the transaction must notifyAll() on the ctx.txLock + // + // billb: wait() is good for debugging purposes, but transaction timeouts will + // never rollback this thread. wait() will wait forever and ever. You must uncomment + // the wait(timeout) lines below to turn on transaction timeouts. BTW, remove this + // comment when wait() is finally removed. try { if( trace ) log.trace("Begin wait on TxLock="+tx); - ctx.getTxLock().wait(); + // FIXME: Uncomment this next line to enable transaction timeouts + // ctx.getTxLock().wait(timeout); + ctx.getTxLock().wait(); // FIXME, delete this line when 2.5 is released if( trace ) log.trace("End wait on TxLock="+tx); } @@ -218,15 +255,8 @@ continue; } -// Maybe my transaction already expired? -Transaction miTx = mi.getTransaction(); if( trace ) log.trace("Begin synchronized(ctx), ctx="+ctx+", mi.tx="+miTx); -if (miTx != null &&
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: user57 Date: 01/07/13 14:50:27 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: o removed extra space in class header javadoc (it was driving me a bit batty) Revision ChangesPath 1.37 +2 -2 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- EntityInstanceInterceptor.java2001/07/13 08:54:11 1.36 +++ EntityInstanceInterceptor.java2001/07/13 21:50:26 1.37 @@ -58,7 +58,7 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @version $Revision: 1.36 $ + * @version $Revision: 1.37 $ * * Revisions: * 2001/06/28: marcf @@ -77,7 +77,6 @@ * * Handle a race condition when there is no ctx transaction * - */ public class EntityInstanceInterceptor extends AbstractInterceptor @@ -89,6 +88,7 @@ protected EntityContainer container; // Static + /** Use a JBoss custom log4j category for trace level logging */ static JBossCategory log = (JBossCategory) JBossCategory.getInstance(EntityInstanceInterceptor.class); ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntitySynchronizationInterceptor.java
User: starksm Date: 01/07/13 01:54:12 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntitySynchronizationInterceptor.java Log: Fix the NPE seen in beforeCompletion in unit tests Ensure that all transaction endings send a notifyAll to txLock holders Deal with race condition to set the ctx transaction Revision ChangesPath 1.36 +34 -17 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- EntityInstanceInterceptor.java2001/07/12 06:51:10 1.35 +++ EntityInstanceInterceptor.java2001/07/13 08:54:11 1.36 @@ -58,7 +58,7 @@ * * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @version $Revision: 1.35 $ + * @version $Revision: 1.36 $ * * Revisions: * 2001/06/28: marcf @@ -73,6 +73,10 @@ * Fix a thread starvation problem due to incomplete condition notification * Add support for trace level diagnositics * + * 2001/07/12: starksm + * + * Handle a race condition when there is no ctx transaction + * */ public class EntityInstanceInterceptor @@ -148,6 +152,7 @@ // And it must correspond to the key. CacheKey key = (CacheKey) mi.getId(); + Transaction tx = null; boolean trace = log.isTraceEnabled(); if( trace ) log.trace("Begin invoke, key="+key); @@ -161,8 +166,10 @@ // Is the instance involved with another transaction? if so we implement pessimistic locking synchronized(ctx.getTxLock()) { -Transaction tx = ctx.getTransaction(); - +tx = ctx.getTransaction(); +if( trace ) + log.trace("Checking tx on ctx="+ctx+", tx="+tx); + // Do we have a running transaction with the context? if (tx != null && // And are we trying to enter with another transaction? @@ -193,19 +200,31 @@ In future versions we can use copies of the instance per transaction */ } - - // The next test is the pure serialization from the EJB specification. + + // The next test is the pure serialization from the EJB specification. + // If we are here we either did not have a tx(tx == null) or this is a + // recursive call and the current ctx.tx == mi.tx synchronized(ctx) { -if( trace ) - log.trace("Begin synchronized(ctx), ctx="+ctx); // synchronized is a time gap, when the thread enters here it can be after "sleep" // we need to make sure that stuff is still kosher - + +// First make sure another thread who saw a null tx has not already assigned a new tx +if( tx == null && ctx.getTransaction() != null ) +{ + ctx = null; + if( trace ) + log.trace("End synchronized(ctx), ctx="+ctx+", lost ctx.tx race"); + continue; +} + // Maybe my transaction already expired? -if (mi.getTransaction() != null && mi.getTransaction().getStatus() == Status.STATUS_MARKED_ROLLBACK) +Transaction miTx = mi.getTransaction(); +if( trace ) + log.trace("Begin synchronized(ctx), ctx="+ctx+", mi.tx="+miTx); +if (miTx != null && miTx.getStatus() == Status.STATUS_MARKED_ROLLBACK) { - log.error("Saw rolled back tx="+mi.getTransaction()); + log.error("Saw rolled back tx="+miTx); throw new RuntimeException("Transaction marked for rollback, possibly a timeout"); } // We do not use pools any longer so the only thing that can happen is that @@ -271,9 +290,9 @@ } // The transaction is associated with the ctx while we own the lock -ctx.setTransaction(mi.getTransaction()); +ctx.setTransaction(miTx); if( trace ) - log.trace("End synchronized(ctx), ctx="+ctx); + log.trace("End synchronized(ctx), ctx="+ctx+", set tx="+miTx); }// end sychronized(ctx) if( trace ) @@ -285,8 +304,8 @@ boolean exceptionThrown = false; - try { -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: starksm Date: 01/07/11 23:51:10 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: Remove the dos carriage returns that somehow got checked in Revision ChangesPath 1.35 +410 -408 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- EntityInstanceInterceptor.java2001/07/11 21:47:14 1.34 +++ EntityInstanceInterceptor.java2001/07/12 06:51:10 1.35 @@ -1,408 +1,410 @@ -/* - * JBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.ejb.plugins; - -import java.lang.reflect.Method; -import java.rmi.RemoteException; -import java.util.Map; -import java.util.HashMap; -import java.util.ArrayList; - -import javax.ejb.EJBObject; -import javax.ejb.CreateException; -import javax.ejb.EJBException; -import javax.ejb.NoSuchEntityException; -import javax.ejb.RemoveException; -import javax.ejb.EntityBean; -import javax.transaction.Status; -import javax.transaction.Synchronization; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; - -import org.jboss.ejb.Container; -import org.jboss.ejb.EntityContainer; -import org.jboss.ejb.EntityPersistenceManager; -import org.jboss.ejb.EntityEnterpriseContext; -import org.jboss.ejb.EnterpriseContext; -import org.jboss.ejb.InstanceCache; -import org.jboss.ejb.InstancePool; -import org.jboss.ejb.MethodInvocation; -import org.jboss.ejb.CacheKey; -import org.jboss.logging.log4j.JBossCategory; -import org.jboss.metadata.EntityMetaData; -import org.jboss.util.Sync; - -/** - * The instance interceptors role is to acquire a context representing - * the target object from the cache. - * - * This particular container interceptor implements pessimistic locking - *on the transaction that is associated with the retrieved instance. If - *there is a transaction associated with the target component and it is - *different from the transaction associated with the MethodInvocation - *coming in then the policy is to wait for transactional commit. - * - * We also implement serialization of calls in here (this is a spec - *requirement). This is a fine grained notify, notifyAll mechanism. We - *notify on ctx serialization locks and notifyAll on global transactional - *locks. - * - * WARNING: critical code, get approval from senior developers - *before changing. - * - * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @author mailto:[EMAIL PROTECTED]";>Scott Stark - * @version $Revision: 1.34 $ - * - * Revisions: - * 2001/06/28: marcf - * - * Moved to new synchronization - * Pools are gone simple design - * two levels of syncrhonization with Tx and ctx - * remove busy wait from previous mechanisms - * - * 2001/07/11: starksm - * - * Fix a thread starvation problem due to incomplete condition notification - * Add support for trace level diagnositics - * - - */ -public class EntityInstanceInterceptor - extends AbstractInterceptor -{ - // Constants - - - // Attributes - - protected EntityContainer container; - - // Static - /** Use a JBoss custom log4j category for trace level logging */ - static JBossCategory log = (JBossCategory) JBossCategory.getInstance(EntityInstanceInterceptor.class); - - // Constructors -- - - // Public - - public void setContainer(Container container) - { - this.container = (EntityContainer)container; - } - - public Container getContainer() - { - return container; - } - - // Interceptor implementation -- - - public Object invokeHome(MethodInvocation mi) - throws Exception - { - // Get context - EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); - - // Pass it to the method invocation - mi.setEnterpriseContext(ctx); - - // Give it the transaction - ctx.setTransaction(mi.getTransaction()); - - // This cont
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: starksm Date: 01/07/11 14:47:14 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: Fix a thread starvation problem due to incomplete condition notification Add support for trace level diagnositics Revision ChangesPath 1.34 +408 -358 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- EntityInstanceInterceptor.java2001/07/10 22:45:41 1.33 +++ EntityInstanceInterceptor.java2001/07/11 21:47:14 1.34 @@ -1,358 +1,408 @@ -/* - * JBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.ejb.plugins; - -import java.lang.reflect.Method; -import java.rmi.RemoteException; -import java.util.Map; -import java.util.HashMap; -import java.util.ArrayList; - -import javax.ejb.EJBObject; -import javax.ejb.CreateException; -import javax.ejb.EJBException; -import javax.ejb.NoSuchEntityException; -import javax.ejb.RemoveException; -import javax.ejb.EntityBean; -import javax.transaction.Status; -import javax.transaction.Synchronization; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; - -import org.jboss.ejb.Container; -import org.jboss.ejb.EntityContainer; -import org.jboss.ejb.EntityPersistenceManager; -import org.jboss.ejb.EntityEnterpriseContext; -import org.jboss.ejb.EnterpriseContext; -import org.jboss.ejb.InstanceCache; -import org.jboss.ejb.InstancePool; -import org.jboss.ejb.MethodInvocation; -import org.jboss.ejb.CacheKey; -import org.jboss.metadata.EntityMetaData; -import org.jboss.logging.Logger; -import org.jboss.util.Sync; - -/** - * The instance interceptors role is to acquire a context representing - * the target object from the cache. - * - * This particular container interceptor implements pessimistic locking - *on the transaction that is associated with the retrieved instance. If - *there is a transaction associated with the target component and it is - *different from the transaction associated with the MethodInvocation - *coming in then the policy is to wait for transactional commit. - * - * We also implement serialization of calls in here (this is a spec - *requirement). This is a fine grained notify, notifyAll mechanism. We - *notify on ctx serialization locks and notifyAll on global transactional - *locks. - * - * WARNING: critical code, get approval from senior developers - *before changing. - * - * @author mailto:[EMAIL PROTECTED]";>Marc Fleury - * @version $Revision: 1.33 $ - * - * Revisions: - * 2001/06/28: marcf - * - * Moved to new synchronization - * Pools are gone simple design - * two levels of syncrhonization with Tx and ctx - * remove busy wait from previous mechanisms - * - */ -public class EntityInstanceInterceptor - extends AbstractInterceptor -{ - // Constants - - - // Attributes - - protected EntityContainer container; - - // Static - - // Constructors -- - - // Public - - public void setContainer(Container container) - { - this.container = (EntityContainer)container; - } - - public Container getContainer() - { - return container; - } - - // Interceptor implementation -- - - public Object invokeHome(MethodInvocation mi) - throws Exception - { - // Get context - EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); - - // Pass it to the method invocation - mi.setEnterpriseContext(ctx); - - // Give it the transaction - ctx.setTransaction(mi.getTransaction()); - - // This context is brand new. We can lock without more "fuss" - // The reason we need to lock it is that it will be put in cache before the end - // of the call. So another thread could access it before we are done. - - ctx.lock(); - - try - { - // Invoke through interceptors - retu
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: user57 Date: 01/07/10 15:45:41 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: o just a re-intent (no code change) Revision ChangesPath 1.33 +280 -277 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- EntityInstanceInterceptor.java2001/07/03 23:13:45 1.32 +++ EntityInstanceInterceptor.java2001/07/10 22:45:41 1.33 @@ -1,9 +1,9 @@ /* -* JBoss, the OpenSource EJB server -* -* Distributable under LGPL license. -* See terms of license at gnu.org. -*/ + * JBoss, the OpenSource EJB server + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package org.jboss.ejb.plugins; import java.lang.reflect.Method; @@ -39,317 +39,320 @@ import org.jboss.util.Sync; /** -* -* The instance interceptors role is to acquire a context representing the target object from the -* cache. -* -* This particular container interceptor implements pessimistic locking on the transaction that -* is associated with the retrieved instance. If there is a transaction associated with the -* target component and it is different from the transaction associated with the MethodInvocation -* coming in then the policy is to wait for transactional commit. -* -* We also implement serialization of calls in here (this is a spec requirement). -* This is a fine grained notify, notifyAll mechanism. We notify on ctx serialization locks and -* notifyAll on global transactional locks -* -* WARNING: critical code, get approval from senior developers before changing. -* -* -* @see -* @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @version $Revision: 1.32 $ -* -* Revisions: -* 2001/06/28: marcf -* -* Moved to new synchronization -* Pools are gone simple design -* two levels of syncrhonization with Tx and ctx -* remove busy wait from previous mechanisms -* -* -*/ + * The instance interceptors role is to acquire a context representing + * the target object from the cache. + * + * This particular container interceptor implements pessimistic locking + *on the transaction that is associated with the retrieved instance. If + *there is a transaction associated with the target component and it is + *different from the transaction associated with the MethodInvocation + *coming in then the policy is to wait for transactional commit. + * + * We also implement serialization of calls in here (this is a spec + *requirement). This is a fine grained notify, notifyAll mechanism. We + *notify on ctx serialization locks and notifyAll on global transactional + *locks. + * + * WARNING: critical code, get approval from senior developers + *before changing. + * + * @author mailto:[EMAIL PROTECTED]";>Marc Fleury + * @version $Revision: 1.33 $ + * + * Revisions: + * 2001/06/28: marcf + * + * Moved to new synchronization + * Pools are gone simple design + * two levels of syncrhonization with Tx and ctx + * remove busy wait from previous mechanisms + * + */ public class EntityInstanceInterceptor -extends AbstractInterceptor + extends AbstractInterceptor { - // Constants - + // Constants - - // Attributes - protected EntityContainer container; + // Attributes + + protected EntityContainer container; - // Static + // Static - // Constructors -- + // Constructors -- - // Public - public void setContainer(Container container) - { - this.container = (EntityContainer)container; - } + // Public + + public void setContainer(Container container) + { + this.container = (EntityContainer)container; + } - public Container getContainer() - { - return container; - } + public Container getContainer() + { + return container;
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: mnf999 Date: 01/07/03 16:13:45 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: The biggy, we rewrite the eii. The driving force was getting rid of the busy wait bug, but it ended up in a full rewrite of the core interceptors. The new interceptor works on a 2 level lock for transactional and context contention. This code has been marked "CRITICAL" further modifications should be approved on jboss-dev. Revision ChangesPath 1.32 +283 -333 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- EntityInstanceInterceptor.java2001/06/18 20:01:23 1.31 +++ EntityInstanceInterceptor.java2001/07/03 23:13:45 1.32 @@ -39,327 +39,277 @@ import org.jboss.util.Sync; /** -* This container acquires the given instance. * +* The instance interceptors role is to acquire a context representing the target object from the +* cache. +* +* This particular container interceptor implements pessimistic locking on the transaction that +* is associated with the retrieved instance. If there is a transaction associated with the +* target component and it is different from the transaction associated with the MethodInvocation +* coming in then the policy is to wait for transactional commit. +* +* We also implement serialization of calls in here (this is a spec requirement). +* This is a fine grained notify, notifyAll mechanism. We notify on ctx serialization locks and +* notifyAll on global transactional locks +* +* WARNING: critical code, get approval from senior developers before changing. +* +* * @see -* @author mailto:[EMAIL PROTECTED]";>Rickard Öberg -* @author mailto:[EMAIL PROTECTED]";>Marc Fleury -* @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini -* @version $Revision: 1.31 $ +* @author mailto:[EMAIL PROTECTED]";>Marc Fleury +* @version $Revision: 1.32 $ +* +* Revisions: +* 2001/06/28: marcf +* +* Moved to new synchronization +* Pools are gone simple design +* two levels of syncrhonization with Tx and ctx +* remove busy wait from previous mechanisms +* +* */ public class EntityInstanceInterceptor extends AbstractInterceptor { -// Constants - - -// Attributes -protected EntityContainer container; - -// Static - -// Constructors -- - -// Public -public void setContainer(Container container) -{ -this.container = (EntityContainer)container; -} - -public Container getContainer() -{ -return container; -} - -// Interceptor implementation -- -public Object invokeHome(MethodInvocation mi) -throws Exception -{ -// Get context -EnterpriseContext ctx = ((EntityContainer)getContainer()).getInstancePool().get(); -mi.setEnterpriseContext(ctx); - -// It is a new context for sure so we can lock it -ctx.lock(); - -try -{ -// Invoke through interceptors -return getNext().invokeHome(mi); -} finally -{ -// Always unlock, no matter what -ctx.unlock(); - -// Still free? Not free if create() was called successfully -if (ctx.getId() == null) -{ -container.getInstancePool().free(ctx); -} -} -} - -public Object invoke(MethodInvocation mi) -throws Exception -{ -// The id store is a CacheKey in the case of Entity -CacheKey key = (CacheKey)mi.getId(); - -// Get cache -AbstractInstanceCache cache = (AbstractInstanceCache)container.getInstanceCache(); -BeanSemaphore mutex = (BeanSemaphore)cache.getLock(key); - -EnterpriseContext ctx = null; - boolean exceptionThrown = false; - -try -{ - boolean waitingOnTransaction = false; // So we don't output LOCKING-WAITING all the time - boolean waitingOnContext = false; // So we don't output LOCKING-WAITING all the time -do -{ -if (mi.getTransaction() != null && mi.getTransac
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java
User: patriot1burke Date: 01/06/15 16:37:05 Modified:src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java Log: If an exception has been thrown, DO NOT remove the ctx from the InstanceCache if the ctx has been registered in an InstanceSynchronization. InstanceSynchronization will remove the key for us. Revision ChangesPath 1.30 +6 -2 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java Index: EntityInstanceInterceptor.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- EntityInstanceInterceptor.java2001/06/11 19:52:26 1.29 +++ EntityInstanceInterceptor.java2001/06/15 23:37:05 1.30 @@ -45,7 +45,7 @@ * @author Rickard Öberg ([EMAIL PROTECTED]) * @author mailto:[EMAIL PROTECTED]";>Marc Fleury * @author mailto:[EMAIL PROTECTED]";>Sebastien Alborini -* @version $Revision: 1.29 $ +* @version $Revision: 1.30 $ */ public class EntityInstanceInterceptor extends AbstractInterceptor @@ -293,7 +293,11 @@ ctx.setTransaction(null); } - if (exceptionThrown) + // If an exception has been thrown, DO NOT remove the ctx + // if the ctx has been registered in an InstanceSynchronization. + // InstanceSynchronization will remove the key for us + if (exceptionThrown && + (tx == null || (mi.getTransaction() != null && !((EntityEnterpriseContext)ctx).isInvoked( { // Discard instance // EJB 1.1 spec 12.3.1 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development