[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2002-04-09 Thread Bill Burke

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.51 $
  +* @version $Revision: 1.52 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  @@ -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

2001-12-30 Thread Adrian Brock

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.47 $
  +* @version $Revision: 1.48 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  @@ -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

2001-12-18 Thread marc fleury

  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 @@
   * pThis 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. 
   *   
   * pWe also implement serialization of calls in here (this is a spec
  @@ -40,7 +40,7 @@
   * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.46 $
  +* @version $Revision: 1.47 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  @@ -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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.7 $
  +* @version $Revision: 1.8 $
   *
   * pbRevisions:/bbr
   * pb2001/07/30: marcf/b
  @@ -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 

Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java TxInterceptorBMT.java

2001-10-23 Thread David Jencks

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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
   -* @version $Revision: 1.30.2.4 $
   +* @version $Revision: 1.30.2.5 $
*
* pbRevisions:/bbr
* pb2001/06/28: marcf/b
   
   
   
   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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
   -* @version $Revision: 1.5.4.2 $
   +* @version $Revision: 1.5.4.3 $
*
* pbRevisions:/bbr
* pb2001/07/30: marcf/b
   
   
   
   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 a href=mailto:[EMAIL PROTECTED];Bill Burke/a
   - * @version $Revision: 1.1.4.1 $
   + * @version $Revision: 1.1.4.2 $
 *
 * pbRevisions:/bbr
 * pb2001/08/08: billb/b
   
   
   
   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 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceInterceptor.java TxInterceptorBMT.java

2001-10-21 Thread Scott M Stark

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.30.2.4 $
  +* @version $Revision: 1.30.2.5 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  
  
  
  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.5.4.2 $
  +* @version $Revision: 1.5.4.3 $
   *
   * pbRevisions:/bbr
   * pb2001/07/30: marcf/b
  
  
  
  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 a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  - * @version $Revision: 1.1.4.1 $
  + * @version $Revision: 1.1.4.2 $
*
* pbRevisions:/bbr
* pb2001/08/08: billb/b
  
  
  
  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 a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a
   *   @author Peter 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java EntityLockInterceptor.java EntityMultiInstanceSynchronizationInterceptor.java StatelessSessionInstanceInterceptor.java TxInterceptorBMT.java

2001-10-20 Thread Scott M Stark

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.30.2.3 $
  +* @version $Revision: 1.30.2.4 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  
  
  
  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
  - *
  -* pThe policies for implementing scheduling (pessimistic locking etc) is 
implemented by pluggable
  -*locks
  -*
  -* pWe 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.
  -*   
  -* pbWARNING: critical code/b, get approval from senior developers
  -*before changing.
  -*
  -* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  -* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.5.4.1 $
  -*
  -* pbRevisions:/bbr
  -* pb2001/07/30: marcf/b
  -* ol
  -*   liInitial revision
  -*   liFactorization of the lock out of the context in cache
  -*   liThe new locking is implement as scheduling in the lock which allows for 
pluggable locks
  -* /ol
  -* pb2001/08/07: billb/b
  -* ol
  -*   liRemoved while loop and moved it to SimplePessimisticEJBLock where it 
belongs.
  -* /ol
  -*/
  -public class EntityLockInterceptor
  -   extends 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-08-07 Thread Bill Burke

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
   * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  -* @version $Revision: 1.41 $
  +* @version $Revision: 1.42 $
   *
   * pbRevisions:/bbr
   * pb2001/06/28: marcf/b
  @@ -107,202 +107,157 @@
   * /ol
   */
   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 {
  +

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-08-01 Thread marc fleury

  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.
  - *
  - * pThis 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. 
  - *   
  - * pWe 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.
  - *   
  - * pbWARNING: critical code/b, get approval from senior developers
  - *before changing.
  - *
  - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  - * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  - * @version $Revision: 1.39 $
  - *
  - * pbRevisions:/bbr
  - * pb2001/06/28: marcf/b
  - * ol
  - *   liMoved to new synchronization
  - *   liPools are gone simple design
  - *   litwo levels of syncrhonization with Tx and ctx
  - *   liremove busy wait from previous mechanisms
  - * /ol
  - * pb2001/07/11: starksm/b
  - * ol
  - *   liFix a thread starvation problem due to incomplete condition notification
  - *   liAdd support for trace level diagnositics
  - * /ol
  - * pb2001/07/12: starksm/b
  - * ol
  - *   liHandle a race condition when there is no ctx transaction
  - * /ol
  - * /ol
  - * pb2001/07/16: billb/b
  - * ol
  - *   liAdded wait(timeout) code, commented out so that we can easily turn it on
  - *   when this new code is done with it's trial period.
  - *   liFixed bug when ejbLoad threw an exception and threads waiting 
  - *   on TxLock did not get awakened.
  - *   
  - * /ol
  - */
  +* The instance interceptors role is to acquire a context representing
  +* the target object from the cache.
  +*
  +* pThis 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. 
  +*   
  +* pWe 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.
  +*   
  +* pbWARNING: critical code/b, get approval from senior developers
  +*before changing.
  +*
  +* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  +* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  +* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  +* @version $Revision: 1.40 $
  +*
  +* pbRevisions:/bbr
  +* pb2001/06/28: marcf/b
  +* ol
  +*   liMoved to new synchronization
  +*   liPools are 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-07-16 Thread Bill Burke

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  - * @version $Revision: 1.38 $
  + * @version $Revision: 1.39 $
*
* pbRevisions:/bbr
* pb2001/06/28: marcf/b
  @@ -84,6 +84,9 @@
* ol
*   liAdded wait(timeout) code, commented out so that we can easily turn it on
*   when this new code is done with it's trial period.
  + *   liFixed bug when ejbLoad threw an exception and threads waiting 
  + *   on TxLock did not get awakened.
  + *   
* /ol
*/
   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 EntitySynchronizationInterceptor.java

2001-07-13 Thread Scott M Stark

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @version $Revision: 1.35 $
  + * @version $Revision: 1.36 $
*
* pbRevisions:/bbr
* pb2001/06/28: marcf/b
  @@ -73,6 +73,10 @@
*   liFix a thread starvation problem due to incomplete condition notification
*   liAdd support for trace level diagnositics
* /ol
  + * pb2001/07/12: starksm/b
  + * ol
  + *   liHandle a race condition when there is no ctx transaction
  + * /ol
   
*/
   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

2001-07-13 Thread Jason Dillon

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @version $Revision: 1.36 $
  + * @version $Revision: 1.37 $
*
* pbRevisions:/bbr
* pb2001/06/28: marcf/b
  @@ -77,7 +77,6 @@
* ol
*   liHandle a race condition when there is no ctx transaction
* /ol
  -
*/
   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

2001-07-12 Thread Scott M Stark

  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.
  - *
  - * pThis 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. 
  - *   
  - * pWe 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.
  - *   
  - * pbWARNING: critical code/b, get approval from senior developers
  - *before changing.
  - *
  - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  - * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @version $Revision: 1.34 $
  - *
  - * pbRevisions:/bbr
  - * pb2001/06/28: marcf/b
  - * ol
  - *   liMoved to new synchronization
  - *   liPools are gone simple design
  - *   litwo levels of syncrhonization with Tx and ctx
  - *   liremove busy wait from previous mechanisms
  - * /ol
  - * pb2001/07/11: starksm/b
  - * ol
  - *   liFix a thread starvation problem due to incomplete condition notification
  - *   liAdd support for trace level diagnositics
  - * /ol
  -
  - */
  -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
  -  

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-07-11 Thread Scott M Stark

  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.
  - *
  - * pThis 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. 
  - *   
  - * pWe 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.
  - *   
  - * pbWARNING: critical code/b, get approval from senior developers
  - *before changing.
  - *
  - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  - * @version $Revision: 1.33 $
  - *
  - * pbRevisions:/bbr
  - * pb2001/06/28: marcf/b
  - * ol
  - *   liMoved to new synchronization
  - *   liPools are gone simple design
  - *   litwo levels of syncrhonization with Tx and ctx
  - *   liremove busy wait from previous mechanisms
  - * /ol
  - */
  -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 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-07-10 Thread Jason Dillon

  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;
   
   /**
  -*
  -* pThe instance interceptors role is to acquire a context representing the 
target object from the 
  -*   cache.
  -*
  -*   pThis 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. 
  -*   
  -*   pWe 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 
  -*   
  -*   pbWARNING: critical code/b, get approval from senior developers before 
changing.
  -*
  -*
  -*   @see related
  -*   @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  -*   @version $Revision: 1.32 $
  -*
  -*   pbRevisions:/bbr
  -*   pb2001/06/28: marcf/b
  -*   ol
  -*   liMoved to new synchronization
  -*   liPools are gone simple design
  -*   litwo levels of syncrhonization with Tx and ctx
  -*   liremove busy wait from previous mechanisms
  -*   /ol
  -*   
  -*/
  + * The instance interceptors role is to acquire a context representing
  + * the target object from the cache.
  + *
  + * pThis 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. 
  + *   
  + * pWe 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.
  + *   
  + * pbWARNING: critical code/b, get approval from senior developers
  + *before changing.
  + *
  + * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  + * @version $Revision: 1.33 $
  + *
  + * pbRevisions:/bbr
  + * pb2001/06/28: marcf/b
  + * ol
  + *   liMoved to new synchronization
  + *   liPools are gone simple design
  + *   litwo levels of syncrhonization with Tx and ctx
  + *   liremove busy wait from previous mechanisms
  + * /ol
  + */
   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;
  -   

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-07-03 Thread mnf999

  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.
   *
  +* pThe instance interceptors role is to acquire a context representing the 
target object from the 
  +*   cache.
  +*
  +*   pThis 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. 
  +*   
  +*   pWe 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 
  +*   
  +*   pbWARNING: critical code/b, get approval from senior developers before 
changing.
  +*
  +*
   *   @see related
  -*   @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a
  -*   @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  -*   @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a
  -*   @version $Revision: 1.31 $
  +*   @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  +*   @version $Revision: 1.32 $
  +*
  +*   pbRevisions:/bbr
  +*   pb2001/06/28: marcf/b
  +*   ol
  +*   liMoved to new synchronization
  +*   liPools are gone simple design
  +*   litwo levels of syncrhonization with Tx and ctx
  +*   liremove busy wait from previous mechanisms
  +*   /ol
  +*   
   */
   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
  -{
  - 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntityInstanceInterceptor.java

2001-06-15 Thread patriot1burke

  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 a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
   *   @author a href=mailto:[EMAIL PROTECTED];Sebastien Alborini/a
  -*   @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