[jboss-cvs] JBossAS SVN: r64793 - branches/JBPAPP_4_2_0_GA_CP/aspects/src/main/org/jboss/aspects/tx.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 22 20:34:35 EDT 2007
Author: bdecoste
Date: 2007-08-22 20:34:34 -0400 (Wed, 22 Aug 2007)
New Revision: 64793
Modified:
branches/JBPAPP_4_2_0_GA_CP/aspects/src/main/org/jboss/aspects/tx/TxPropagationInterceptor.java
Log:
fix for org.jboss.ejb3.test.clusteredsession.unit.SimpleIsLocalInterceptorUnitTestCase failures and addition of related test for removing IsLocalInterceptor
Modified: branches/JBPAPP_4_2_0_GA_CP/aspects/src/main/org/jboss/aspects/tx/TxPropagationInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/aspects/src/main/org/jboss/aspects/tx/TxPropagationInterceptor.java 2007-08-23 00:34:31 UTC (rev 64792)
+++ branches/JBPAPP_4_2_0_GA_CP/aspects/src/main/org/jboss/aspects/tx/TxPropagationInterceptor.java 2007-08-23 00:34:34 UTC (rev 64793)
@@ -25,9 +25,12 @@
import javax.transaction.TransactionManager;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.logging.Logger;
import org.jboss.tm.TransactionManagerLocator;
+import org.jboss.tm.TransactionPropagationContextFactory;
import org.jboss.tm.TransactionPropagationContextUtil;
+
/**
* Comment
*
@@ -55,12 +58,27 @@
public Object invoke(Invocation invocation) throws Throwable
{
- Object tpc = invocation.getMetaData(ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT, ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT);
- if (tpc != null)
+ Object importedTpc = invocation.getMetaData(ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT, ClientTxPropagationInterceptor.TRANSACTION_PROPAGATION_CONTEXT);
+ if (importedTpc != null)
{
+
Transaction tx = tm.getTransaction();
- if (tx != null) throw new RuntimeException("cannot import a transaction context when a transaction is already associated with the thread");
- Transaction importedTx = TransactionPropagationContextUtil.getTPCImporter().importTransactionPropagationContext(tpc);
+
+ if (tx != null)
+ {
+ TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactory();
+ Object tpc = null;
+ if (tpcFactory != null)
+ tpc = tpcFactory.getTransactionPropagationContext();
+
+ if (importedTpc.equals(tpc))
+ return invocation.invokeNext();
+ else
+ throw new RuntimeException("cannot import a transaction context when a transaction is already associated with the thread");
+ }
+
+ Transaction importedTx = TransactionPropagationContextUtil.getTPCImporter().importTransactionPropagationContext(importedTpc);
+
tm.resume(importedTx);
try
{
More information about the jboss-cvs-commits
mailing list