Class XATerminatorImple

java.lang.Object
com.arjuna.ats.internal.jta.transaction.jts.jca.XATerminatorImple
All Implemented Interfaces:
XATerminatorExtensions, jakarta.resource.spi.XATerminator, org.jboss.tm.ExtendedJBossXATerminator
Direct Known Subclasses:
XATerminator

public class XATerminatorImple extends Object implements jakarta.resource.spi.XATerminator, XATerminatorExtensions, org.jboss.tm.ExtendedJBossXATerminator
The XATerminator implementation.
Author:
mcl
  • Constructor Details

    • XATerminatorImple

      public XATerminatorImple()
  • Method Details

    • commit

      public void commit(Xid xid, boolean onePhase) throws XAException
      Specified by:
      commit in interface jakarta.resource.spi.XATerminator
      Throws:
      XAException
    • forget

      public void forget(Xid xid) throws XAException
      Specified by:
      forget in interface jakarta.resource.spi.XATerminator
      Throws:
      XAException
    • prepare

      public int prepare(Xid xid) throws XAException
      Specified by:
      prepare in interface jakarta.resource.spi.XATerminator
      Throws:
      XAException
    • recover

      public Xid[] recover(int flag) throws XAException
      Specified by:
      recover in interface jakarta.resource.spi.XATerminator
      Throws:
      XAException
    • rollback

      public void rollback(Xid xid) throws XAException
      Specified by:
      rollback in interface jakarta.resource.spi.XATerminator
      Throws:
      XAException
    • beforeCompletion

      public boolean beforeCompletion(Xid xid) throws jakarta.transaction.SystemException
      Description copied from interface: XATerminatorExtensions
      Call beforeCompletion on the registered instance. Exceptions will cause the transaction to be set rollback only. Note: this will run beforeCompletion even on setRollbackOnly transactions. Users may wish to avoid calling this method in such cases, or prior to calling rollback.
      Specified by:
      beforeCompletion in interface XATerminatorExtensions
      Parameters:
      xid - the transaction instance.
      Returns:
      success (or not).
      Throws:
      jakarta.transaction.SystemException
    • getTransaction

      public jakarta.transaction.Transaction getTransaction(Xid xid) throws XAException
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Convert an imported Xid into a Transaction object.
      Specified by:
      getTransaction in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      xid - the global Xid of the target transaction to lookup
      Returns:
      A transaction object corresponding to the Xid or null if there is no such transaction
      Throws:
      XAException - with code XA_RBROLLBACK if the transaction has already aborted
    • importTransaction

      public org.jboss.tm.TransactionImportResult importTransaction(Xid xid, int timeoutIfNew) throws XAException
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      A thread safe method to convert an imported Xid into a Transaction object. If the transaction does not exist then a subordinate transaction for the xid will be created and associated with the global transaction. In the case where a new subordinate is created then the timeout parameter will be used. If timeout is non zero then the inflowed transaction will survive for that period before being eligible to be aborted. If timeout is zero then no timeout will be associated with the subordinate transaction.
      Specified by:
      importTransaction in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      xid - The global Xid of the target transaction to lookup
      timeoutIfNew - The timeout associated with the global transaction if one was created.
      Returns:
      A wrapper containing the transaction object corresponding to the Xid or null if there is no such transaction
      Throws:
      XAException - with code XA_RBROLLBACK if the transaction has already aborted
    • getImportedTransaction

      public SubordinateTransaction getImportedTransaction(Xid xid) throws XAException
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Lookup an imported transaction by its Xid
      Specified by:
      getImportedTransaction in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      xid - the Xid of the transaction to lookup
      Returns:
      the corresponding imported transaction object or null
      Throws:
      XAException - if the transaction is known to have rolled back
    • getTransactionById

      public jakarta.transaction.Transaction getTransactionById(Object id)
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Look up a transaction by its id
      Specified by:
      getTransactionById in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      id - an id that uniquelly identifies a transaction
      Returns:
    • getCurrentTransactionId

      public Object getCurrentTransactionId()
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Obtain the unique id of the currently associated transaction
      Specified by:
      getCurrentTransactionId in interface org.jboss.tm.ExtendedJBossXATerminator
      Returns:
      the id or null if no transaction is associated with the calling thread
    • removeImportedTransaction

      public void removeImportedTransaction(Xid xid) throws XAException
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      forget about this imported transaction.
      Specified by:
      removeImportedTransaction in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      xid - the global Xid of the transaction.
      Throws:
      XAException - thrown if there are any errors.
    • getXidsToRecoverForParentNode

      public Xid[] getXidsToRecoverForParentNode(boolean recoverInFlight, String parentNodeName, int recoveryFlags) throws XAException
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Get a list of Xids that are potentially recoverable.
      Specified by:
      getXidsToRecoverForParentNode in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      recoverInFlight - indicates whether or not to include transactions that have not begun 2PC
      parentNodeName - If not null then only recover transactions for this node
      recoveryFlags - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter. These constants are defined in javax.transaction.xa.XAResource interface
      Returns:
      an array of Xids to recover
      Throws:
      XAException - An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
    • doRecover

      public Xid[] doRecover(Xid xid, String parentNodeName) throws XAException, jakarta.transaction.NotSupportedException

      Recovering /JCA section of object store. The filtering functionality on xid or parentNodeName is not permitted and throws NotSupportedException.
      Expected to be called only with null parameters doRecover(null, null)

      Specified by:
      doRecover in interface org.jboss.tm.ExtendedJBossXATerminator
      Parameters:
      xid - has to be null
      parentNodeName - has to be null
      Returns:
      array of subordinate recovered xids
      Throws:
      XAException - if recovery operation fails for the XA protocol reason
      jakarta.transaction.NotSupportedException - if not null params are passes as method parameters
    • isRecoveryByNodeOrXidSupported

      public boolean isRecoveryByNodeOrXidSupported()
      Description copied from interface: org.jboss.tm.ExtendedJBossXATerminator
      Test whether or not the ExtendedJBossXATerminator.doRecover(Xid, String) call will throw NotSupportedException
      Specified by:
      isRecoveryByNodeOrXidSupported in interface org.jboss.tm.ExtendedJBossXATerminator
      Returns: