Package org.objectweb.joram.client.jms
Class XAResource
- java.lang.Object
-
- org.objectweb.joram.client.jms.XAResource
-
- All Implemented Interfaces:
XAResource
public class XAResource extends Object implements XAResource
AXAResourceinstance is used by aXASessioninstance as a delegate to a Transaction Manager.
-
-
Field Summary
Fields Modifier and Type Field Description private XidcurrentXidThe current transaction identifier.private booleanenlistedtrueif the resource is enlisted in a transaction.private static org.objectweb.util.monolog.api.Loggerlogger(package private) XAResourceMngrrmThe XA connection acting as resource manager.(package private) SessionsessThe session producing and consuming messages.-
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 XAResource(XAResourceMngr rm, Session sess)Constructs an XA resource representing a given session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit(Xid xid, boolean onePhase)Commits the resource.voidend(Xid xid, int flag)Delists this resource.voidforget(Xid xid)Not implemented as transactions are not heuristically completed.intgetTransactionTimeout()Returns 0 as timeout feature is not supported.booleanisSameRM(XAResource o)Checks if this resource shares the same resource manager (XAConnection) with an other resource.intprepare(Xid xid)Prepares the resource.Xid[]recover(int flag)Recovers the prepared transactions identifiers.voidrollback(Xid xid)Rolls the resource back.booleansetTransactionTimeout(int seconds)Returnsfalseas timeout feature is not supported.voidstart(Xid xid, int flag)Enlists this resource in a given transaction.
-
-
-
Field Detail
-
enlisted
private boolean enlisted
trueif the resource is enlisted in a transaction.
-
currentXid
private Xid currentXid
The current transaction identifier.
-
rm
XAResourceMngr rm
The XA connection acting as resource manager.
-
sess
Session sess
The session producing and consuming messages.
-
logger
private static org.objectweb.util.monolog.api.Logger logger
-
-
Constructor Detail
-
XAResource
public XAResource(XAResourceMngr rm, Session sess)
Constructs an XA resource representing a given session.
-
-
Method Detail
-
start
public void start(Xid xid, int flag) throws XAException
Enlists this resource in a given transaction.- Specified by:
startin interfaceXAResource- Throws:
XAException- If the resource is already enlisted in a transaction, or if the RM fails to enlist the resource.
-
end
public void end(Xid xid, int flag) throws XAException
Delists this resource.- Specified by:
endin interfaceXAResource- Throws:
XAException- If the resource is not enlisted in the specified transaction, or if the RM fails to delist the resource.
-
prepare
public int prepare(Xid xid) throws XAException
Prepares the resource.- Specified by:
preparein interfaceXAResource- Throws:
XAException- If the RM fails to prepare the resource.
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
Commits the resource.- Specified by:
commitin interfaceXAResource- Throws:
XAException- If the RM fails to commit the resource.
-
rollback
public void rollback(Xid xid) throws XAException
Rolls the resource back.- Specified by:
rollbackin interfaceXAResource- Throws:
XAException- If the RM fails to roll the resource back.
-
recover
public Xid[] recover(int flag) throws XAException
Recovers the prepared transactions identifiers.- Specified by:
recoverin interfaceXAResource- Throws:
XAException- If the RM fails to recover.
-
forget
public void forget(Xid xid) throws XAException
Not implemented as transactions are not heuristically completed.- Specified by:
forgetin interfaceXAResource- Throws:
XAException- Always thrown.
-
setTransactionTimeout
public boolean setTransactionTimeout(int seconds) throws XAExceptionReturnsfalseas timeout feature is not supported.- Specified by:
setTransactionTimeoutin interfaceXAResource- Throws:
XAException- Never thrown.
-
getTransactionTimeout
public int getTransactionTimeout() throws XAExceptionReturns 0 as timeout feature is not supported.- Specified by:
getTransactionTimeoutin interfaceXAResource- Throws:
XAException- Never thrown.
-
isSameRM
public boolean isSameRM(XAResource o) throws XAException
Checks if this resource shares the same resource manager (XAConnection) with an other resource.- Specified by:
isSameRMin interfaceXAResource- Throws:
XAException- Never thrown.
-
-