1 Reply Latest reply on Jan 7, 2007 9:45 AM by Mark Little

    JBoss TS JTA - unsetting current transaction association

    Tim Fox Master

      If I do the following:

      
      txMgr.begin();
      
      Transaction tx = txMgr.getTransaction();
      
      tx.commit();
      
      tx = txMgr.getTransaction();
      
      assertNull(tx);
      
      


      The assertion fails (I would expect the tx.commit() to cause the association between the current thread and transaction to be broken).

      But the following passes:

      
      txMgr.begin();
      
      Transaction tx = txMgr.getTransaction();
      
      txMgr.commit();
      
      tx = txMgr.getTransaction();
      
      assertNull(tx);
      
      


      Is this behaviour by design? With the old JBoss JTA implementation both the above cases would pass

        • 1. Re: JBoss TS JTA - unsetting current transaction association
          Mark Little Master

          It is bad/broken design. Only going through TransactionManager/UserTransaction do you get thread-to-transaction association/disassociation. (Same as using Current in OTS). If you terminate the transaction directly through Transaction (equivalent to using the Terminator in OTS) then you the thread-to-transaction association is not modified. You'll need to either use TM/UT or do an explicit suspend afterwards on the calling thread.