User: azakkerman Date: 02/02/03 14:55:53 Modified: src/main/org/jboss/ejb EnterpriseContext.java Log: Update UserTransactionImpl to better conform to the spec which says that the thread has to be cleaned from the tx upon commit() and rollback(). In order to conform to this, we need to remove tx from EnterpriseContext upon commit() or rollback() of the UserTransaction. When this is done, and the BMT TxInterceptor comes to assign the thread that serves next invocation on the BMT bean to the ctx transaction, it gets the right 'null' tx. If this is not taken care of, some TMs (namely Tyrex) may fail since a committed or rolled-back tx from the ctx will be resumed in the BMT interceptor. Revision Changes Path 1.42 +21 -3 jboss/src/main/org/jboss/ejb/EnterpriseContext.java Index: EnterpriseContext.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EnterpriseContext.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- EnterpriseContext.java 2001/12/19 05:13:37 1.41 +++ EnterpriseContext.java 2002/02/03 22:55:53 1.42 @@ -47,7 +47,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a> * @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a> * @author <a href="mailto:[EMAIL PROTECTED]">Ole Husgaard</a> - * @version $Revision: 1.41 $ + * @version $Revision: 1.42 $ * * Revisions: * 2001/06/29: marcf @@ -434,13 +434,31 @@ java.lang.IllegalStateException, SystemException { - con.getTransactionManager().commit(); + try { + con.getTransactionManager().commit(); + } finally { + // According to the spec, after commit and rollback was called on + // UserTransaction, the thread is associated with no transaction. + // Since the BMT Tx interceptor will associate the thread from the context + // with the thread that comes in on an invocation, we must set the + // context transaction to null + setTransaction(null); + } } public void rollback() throws IllegalStateException, SecurityException, SystemException { - con.getTransactionManager().rollback(); + try { + con.getTransactionManager().rollback(); + } finally { + // According to the spec, after commit and rollback was called on + // UserTransaction, the thread is associated with no transaction. + // Since the BMT Tx interceptor will associate the thread from the context + // with the thread that comes in on an invocation, we must set the + // context transaction to null + setTransaction(null); + } } public void setRollbackOnly()
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development