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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
beforeCompletion
(Xid xid) Call beforeCompletion on the registered instance.void
Xid[]
Recovering /JCA section of object store.void
Obtain the unique id of the currently associated transactionLookup an imported transaction by its Xidjakarta.transaction.Transaction
getTransaction
(Xid xid) Convert an imported Xid into a Transaction object.jakarta.transaction.Transaction
Look up a transaction by its idXid[]
getXidsToRecoverForParentNode
(boolean recoverInFlight, String parentNodeName, int recoveryFlags) Get a list of Xids that are potentially recoverable.org.jboss.tm.TransactionImportResult
importTransaction
(Xid xid, int timeoutIfNew) A thread safe method to convert an imported Xid into a Transaction object.boolean
Test whether or not theExtendedJBossXATerminator.doRecover(Xid, String)
call will throw NotSupportedExceptionint
Xid[]
recover
(int flag) void
forget about this imported transaction.void
-
Constructor Details
-
XATerminatorImple
public XATerminatorImple()
-
-
Method Details
-
commit
- Specified by:
commit
in interfacejakarta.resource.spi.XATerminator
- Throws:
XAException
-
forget
- Specified by:
forget
in interfacejakarta.resource.spi.XATerminator
- Throws:
XAException
-
prepare
- Specified by:
prepare
in interfacejakarta.resource.spi.XATerminator
- Throws:
XAException
-
recover
- Specified by:
recover
in interfacejakarta.resource.spi.XATerminator
- Throws:
XAException
-
rollback
- Specified by:
rollback
in interfacejakarta.resource.spi.XATerminator
- Throws:
XAException
-
beforeCompletion
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 interfaceXATerminatorExtensions
- Parameters:
xid
- the transaction instance.- Returns:
- success (or not).
- Throws:
jakarta.transaction.SystemException
-
getTransaction
Description copied from interface:org.jboss.tm.ExtendedJBossXATerminator
Convert an imported Xid into a Transaction object.- Specified by:
getTransaction
in interfaceorg.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 interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Parameters:
xid
- The global Xid of the target transaction to lookuptimeoutIfNew
- 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
Description copied from interface:org.jboss.tm.ExtendedJBossXATerminator
Lookup an imported transaction by its Xid- Specified by:
getImportedTransaction
in interfaceorg.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
Description copied from interface:org.jboss.tm.ExtendedJBossXATerminator
Look up a transaction by its id- Specified by:
getTransactionById
in interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Parameters:
id
- an id that uniquelly identifies a transaction- Returns:
-
getCurrentTransactionId
Description copied from interface:org.jboss.tm.ExtendedJBossXATerminator
Obtain the unique id of the currently associated transaction- Specified by:
getCurrentTransactionId
in interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Returns:
- the id or null if no transaction is associated with the calling thread
-
removeImportedTransaction
Description copied from interface:org.jboss.tm.ExtendedJBossXATerminator
forget about this imported transaction.- Specified by:
removeImportedTransaction
in interfaceorg.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 interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Parameters:
recoverInFlight
- indicates whether or not to include transactions that have not begun 2PCparentNodeName
- If not null then only recover transactions for this noderecoveryFlags
- 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 parametersdoRecover(null, null)
- Specified by:
doRecover
in interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Parameters:
xid
- has to be nullparentNodeName
- has to be null- Returns:
- array of subordinate recovered xids
- Throws:
XAException
- if recovery operation fails for the XA protocol reasonjakarta.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 theExtendedJBossXATerminator.doRecover(Xid, String)
call will throw NotSupportedException- Specified by:
isRecoveryByNodeOrXidSupported
in interfaceorg.jboss.tm.ExtendedJBossXATerminator
- Returns:
-