1 Reply Latest reply on Jun 8, 2006 9:50 PM by ofrijole

    Handling failure during commit

    ofrijole

      I'm using JBoss 4.0.4 with a JCA 1.0 (I know! And I will re-write it at some point!) LocalTransaction resource adapter. During a commit there is a scenario where my RA detects a failure and needs to perform rollback.

      I'm wondering how I should handle this ... do I need to perform the necessary rollback logic within my RA then call notifyOnRollback on the ManagedConnection ... or should I throw the exception I encounter out of commit and rely on JBoss to invoke rollback.

      I've found various containers (e.g. WebLogic/WebSphere) to differ on this point in the past.

      Thanks!

        • 1. More information
          ofrijole

          I confirmed that what I'm currently doing is performing appropriate rollback logic inside my local transaction commit() ... then I invoke the

          ConnectionEventListener listener =
          (ConnectionEventListener) m_listener.get(i);
          listener.localTransactionRolledback (new ConnectionEvent
          (this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK));

          I get the following warning on the console:

          18:44:31,913 WARN [TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=hyperactive/20, BranchQual=, localId=20] errorCode=XAER_PROTO
          org.jboss.resource.connectionmanager.JBossLocalXAException: wrong xid in rollback: expected: null, got: XidImpl[FormatId=257, GlobalId=hyperactive/20, BranchQual=1, localId=20]
          at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.rollback(TxConnectionManager.java:948)

          I've also tried simply throwing the exception out of the LocalTransaction.commit() and relying on JBoss to clean up. I still get the warning above but things look even worse (e.g. I can't shut down the server).

          Other than the warning, the explicit rollback logic + notification seem to result in ok behavior. Is the warning to be taken as a serious problem? Or is there some way I can improve my logic to ensure that the warning is not raised.