[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-1005) TxPropagationInterceptor requires use of IsLocalInterceptor

Brian Stansberry (JIRA) jira-events at lists.jboss.org
Wed Jul 4 10:38:51 EDT 2007


TxPropagationInterceptor requires use of IsLocalInterceptor
-----------------------------------------------------------

                 Key: EJBTHREE-1005
                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-1005
             Project: EJB 3.0
          Issue Type: Bug
    Affects Versions: AS 4.2.0 GA
            Reporter: Brian Stansberry
         Assigned To: Brian Stansberry
            Priority: Minor


The TxPropagationInterceptor will fail if a tx is running and a call to a local bean is not routed through IsLocalInterceptor.invokeLocal().  This means the IsLocalInterceptor.invokeLocal() routing can't be effectively disabled, which is a user request that comes up fairly often for EJB2. Users request this when they want the EJB requests load balanced, with no preference for the in-VM bean.

The same thing isn't a problem in EJB2, where transaction propagation is a function of the Invoker; the LocalInvoker just doesn't do it.  But EJB3 doesn't have that option -- Remoting will bypass any invoker if it detects an in-VM target.

Couple possibilities:

1) Change TxPropagationInterceptor from:

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);
tm.resume(importedTx);

to:

Transaction tx = tm.getTransaction();
Transaction importedTx = TransactionPropagationContextUtil.getTPCImporter().importTransactionPropagationContext(tpc);
if (tx != null) 
{
   if (tx != importedTx)
   {
      throw new RuntimeException("cannot import a transaction context when a transaction is already associated with the thread");
   }
else
{
   tm.resume(importedTx);
}
         
2) Have IsLocalInterceptor add some transient metadata to the invocation if it doesn't route the request via invokeLocal() -- i.e. if it expects the call is going remote. TxPropagationInterceptor can check for that metadata; if found it knows the call didn't actually go remote and can skip the import of the tx.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list