dain        2005/02/14 22:24:04

  Modified:    modules/core/src/java/org/openejb/transaction
                        BeanPolicy.java ContainerPolicy.java
  Log:

  o Finished GERONIMO-181 Transaction propogation accross calls to stateful 
session beans
  
  o Added code resume and suspend the BMT transaction to 
StatefulInstanceInterceptor.  This code must be here because the instance 
context holds the suspended transaction, and this context is not available in 
the transaction interceptor.  Also the code that "finds" the correct instance 
relies on the transaction context already being established
  
  o Enabled stateful tests for session synchronization callbacks
  
  o Session synchronization callbacks now go through the system interceptor 
chain
  
  o Container policies now setRollbackOnly and throw a 
TransactionRolledbac[Local]Exception when a system exception is thrown in an 
inherited transaction
  
  o Fixed GERONIMO-579 UserTransaction broken after BMT calls BMT
  
  o Added support for ejb-ql back into the openejb-jar.xml file so 1.1 beans 
can use ejb-ql for a query specification
  
  o Fixed client side handle serialization code
  
  o Fixed stateful session ejb object isIdentical code; was not comparing 
primary key
  
  o Fixed handling of remove methods
  
  Revision  Changes    Path
  1.7       +4 -3      
openejb/modules/core/src/java/org/openejb/transaction/BeanPolicy.java
  
  Index: BeanPolicy.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/transaction/BeanPolicy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BeanPolicy.java   2 Feb 2005 02:40:58 -0000       1.6
  +++ BeanPolicy.java   15 Feb 2005 03:24:04 -0000      1.7
  @@ -61,6 +61,7 @@
   public class BeanPolicy {
       private static final Log log = LogFactory.getLog(BeanPolicy.class);
   
  +    // TODO eliminate the two policies... they are exactally the same
       public static final TransactionPolicy Stateless = new 
TransactionPolicy() {
           public InvocationResult invoke(Interceptor interceptor, 
EJBInvocation ejbInvocation, TransactionContextManager 
transactionContextManager) throws Throwable {
               TransactionContext clientContext = 
transactionContextManager.getContext();
  @@ -118,8 +119,7 @@
                   try {
                       InvocationResult result = 
interceptor.invoke(ejbInvocation);
                       if (beanContext != 
transactionContextManager.getContext()) {
  -//                        throw new UncommittedTransactionException("Support 
for transactions held between invocations is not supported");
  -                        new UncommittedTransactionException("Support for 
transactions held between invocations is not supported").printStackTrace();
  +                        throw new UncommittedTransactionException();
                       }
                       beanContext.commit();
                       return result;
  @@ -151,4 +151,5 @@
               return Stateful;
           }
       };
  +
   }
  
  
  
  1.7       +28 -2     
openejb/modules/core/src/java/org/openejb/transaction/ContainerPolicy.java
  
  Index: ContainerPolicy.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/transaction/ContainerPolicy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContainerPolicy.java      12 Oct 2004 20:01:13 -0000      1.6
  +++ ContainerPolicy.java      15 Feb 2005 03:24:04 -0000      1.7
  @@ -48,8 +48,10 @@
   package org.openejb.transaction;
   
   import javax.ejb.TransactionRequiredLocalException;
  +import javax.ejb.TransactionRolledbackLocalException;
   import javax.transaction.RollbackException;
   import javax.transaction.TransactionRequiredException;
  +import javax.transaction.TransactionRolledbackException;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -121,6 +123,13 @@
                   try {
                       ejbInvocation.setTransactionContext(clientContext);
                       return interceptor.invoke(ejbInvocation);
  +                } catch (Throwable t){
  +                    ((InheritableTransactionContext) 
clientContext).setRollbackOnly();
  +                    if (ejbInvocation.getType().isLocal()) {
  +                        throw new 
TransactionRolledbackLocalException().initCause(t);
  +                    } else {
  +                        throw new 
TransactionRolledbackException().initCause(t);
  +                    }
                   } finally {
                       ejbInvocation.setTransactionContext(null);
                   }
  @@ -169,6 +178,17 @@
                   try {
                       ejbInvocation.setTransactionContext(clientContext);
                       return interceptor.invoke(ejbInvocation);
  +                } catch (Throwable t){
  +                    if (clientContext instanceof 
InheritableTransactionContext) {
  +                        ((InheritableTransactionContext) 
clientContext).setRollbackOnly();
  +                        if (ejbInvocation.getType().isLocal()) {
  +                            throw new 
TransactionRolledbackLocalException().initCause(t);
  +                        } else {
  +                            // can't set an initCause on a 
TransactionRolledbackException
  +                            throw new 
TransactionRolledbackException(t.getMessage());
  +                        }
  +                    }
  +                    throw t;
                   } finally {
                       ejbInvocation.setTransactionContext(null);
                   }
  @@ -251,6 +271,13 @@
                   try {
                       ejbInvocation.setTransactionContext(clientContext);
                       return interceptor.invoke(ejbInvocation);
  +                } catch (Throwable t){
  +                    ((InheritableTransactionContext) 
clientContext).setRollbackOnly();
  +                    if (ejbInvocation.getType().isLocal()) {
  +                        throw new 
TransactionRolledbackLocalException().initCause(t);
  +                    } else {
  +                        throw new 
TransactionRolledbackException().initCause(t);
  +                    }
                   } finally {
                       ejbInvocation.setTransactionContext(null);
                   }
  @@ -317,5 +344,4 @@
               return ContainerPolicy.Never;
           }
       }
  -
   }
  
  
  

Reply via email to