Multiple threads active in the same transaction


    Because JBossTS is multi-thread aware, this means that you can have situations where multiple threads are running in the scope of the same transaction. As long as those threads are well behaved, you should have no problems (check the documentation for more details on things like Checked Transaction Semantics). However, sometimes you may see something like the following:

    WARN [arjLoggerI18N] [BasicAction_58] - Abort of action id -3f57cb74:c9a4:499eb149:a92 invoked while multiple threads active within it.
    WARN [arjLoggerI18N] [CheckedAction_2] - CheckedAction::check - atomic action -3f57cb74:c9a4:499eb149:a92 aborting with 1 threads active!

    This could be due to an application thread terminating the transaction while another application thread is active. However, it could also be due to the transaction timeout going off and JBossTS terminating the transaction automatically while the application thread is still associated with it. JBossTS differs from the old transaction manager in that it will roll back transactions whose timeouts go off as soon as it can, rather than just marking them as rollback-only.


    If you get into this situation, the first thing to check would be your application code for rouge thread-to-transaction termination. If that does not yield any results, look at the timeout: you may need to extend it.


    In situations where a timeout occurs, the business logic thread may not notice the transaction has been rolled back until it tries a commit. In such cases you may see something like:

      [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active!
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1379)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
      at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)


    Your code should have exception handling around transaction termination calls to deal with both IllegalStateException and RollbackException.