Package org.apache.activemq.artemis.ra
Class ActiveMQRAXAResource
- java.lang.Object
-
- org.apache.activemq.artemis.ra.ActiveMQRAXAResource
-
- All Implemented Interfaces:
XAResource,ActiveMQXAResource
public class ActiveMQRAXAResource extends Object implements ActiveMQXAResource
ActiveMQXAResource.
-
-
Field Summary
-
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
-
-
Constructor Summary
Constructors Constructor Description ActiveMQRAXAResource(ActiveMQRAManagedConnection managedConnection, XAResource xaResource)Create a new ActiveMQXAResource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit(Xid xid, boolean onePhase)Commitvoidend(Xid xid, int flags)Endvoidforget(Xid xid)ForgetXAResourcegetResource()intgetTransactionTimeout()Get the transaction timeout in secondsbooleanisSameRM(XAResource xaRes)IsSameRMintprepare(Xid xid)PrepareXid[]recover(int flag)Recovervoidrollback(Xid xid)RollbackbooleansetTransactionTimeout(int seconds)Set the transaction timeoutvoidstart(Xid xid, int flags)Start
-
-
-
Constructor Detail
-
ActiveMQRAXAResource
public ActiveMQRAXAResource(ActiveMQRAManagedConnection managedConnection, XAResource xaResource)
Create a new ActiveMQXAResource.- Parameters:
managedConnection- the managed connectionxaResource- the xa resource
-
-
Method Detail
-
start
public void start(Xid xid, int flags) throws XAException
Start- Specified by:
startin interfaceXAResource- Parameters:
xid- A global transaction identifierflags- One of TMNOFLAGS, TMJOIN, or TMRESUME- Throws:
XAException- An error has occurred
-
end
public void end(Xid xid, int flags) throws XAException
End- Specified by:
endin interfaceXAResource- Parameters:
xid- A global transaction identifierflags- One of TMSUCCESS, TMFAIL, or TMSUSPEND.- Throws:
XAException- An error has occurred
-
prepare
public int prepare(Xid xid) throws XAException
Prepare- Specified by:
preparein interfaceXAResource- Parameters:
xid- A global transaction identifier- Returns:
- XA_RDONLY or XA_OK
- Throws:
XAException- An error has occurred
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
Commit- Specified by:
commitin interfaceXAResource- Parameters:
xid- A global transaction identifieronePhase- If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.- Throws:
XAException- An error has occurred
-
rollback
public void rollback(Xid xid) throws XAException
Rollback- Specified by:
rollbackin interfaceXAResource- Parameters:
xid- A global transaction identifier- Throws:
XAException- An error has occurred
-
forget
public void forget(Xid xid) throws XAException
Forget- Specified by:
forgetin interfaceXAResource- Parameters:
xid- A global transaction identifier- Throws:
XAException- An error has occurred
-
isSameRM
public boolean isSameRM(XAResource xaRes) throws XAException
IsSameRM- Specified by:
isSameRMin interfaceXAResource- Parameters:
xaRes- An XAResource object whose resource manager instance is to be compared with the resource manager instance of the target object.- Returns:
- True if its the same RM instance; otherwise false.
- Throws:
XAException- An error has occurred
-
recover
public Xid[] recover(int flag) throws XAException
Recover- Specified by:
recoverin interfaceXAResource- Parameters:
flag- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS- Returns:
- Zero or more XIDs
- Throws:
XAException- An error has occurred
-
getTransactionTimeout
public int getTransactionTimeout() throws XAExceptionGet the transaction timeout in seconds- Specified by:
getTransactionTimeoutin interfaceXAResource- Returns:
- The transaction timeout
- Throws:
XAException- An error has occurred
-
setTransactionTimeout
public boolean setTransactionTimeout(int seconds) throws XAExceptionSet the transaction timeout- Specified by:
setTransactionTimeoutin interfaceXAResource- Parameters:
seconds- The number of seconds- Returns:
- True if the transaction timeout value is set successfully; otherwise false.
- Throws:
XAException- An error has occurred
-
getResource
public XAResource getResource()
- Specified by:
getResourcein interfaceActiveMQXAResource
-
-