Closing XA Sessions

To close an XA Session, call the close() method. (The close() method is inherited from the javax.jms.Session interface.)

To cleanly terminate an XA Session, the client should call XAResource.commit(...) or XAResource.rollback() on all transactions prior to closing the XA Session.

If an XA Session with an active transaction is closed without first committing that transaction, the following occurs:

  • The API rolls back that transaction. Closing an XA Session also unbinds any producers and consumers from endpoints.
  • If any operations are outstanding on the XAResource, they are unblocked and an XAException is thrown.
  • If any operations are attempted on a closed Session, an XAException is thrown.