public class XAResource extends Object implements XAResource
XAResource
instance is used by a XASession
instance as a delegate to a Transaction Manager.Modifier and Type | Field and Description |
---|---|
private Xid |
currentXid
The current transaction identifier.
|
private boolean |
enlisted
true if the resource is enlisted in a transaction. |
private static org.objectweb.util.monolog.api.Logger |
logger |
(package private) XAResourceMngr |
rm
The XA connection acting as resource manager.
|
(package private) Session |
sess
The session producing and consuming messages.
|
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Constructor and Description |
---|
XAResource(XAResourceMngr rm,
Session sess)
Constructs an XA resource representing a given session.
|
Modifier and Type | Method and Description |
---|---|
void |
commit(Xid xid,
boolean onePhase)
Commits the resource.
|
void |
end(Xid xid,
int flag)
Delists this resource.
|
void |
forget(Xid xid)
Not implemented as transactions are not heuristically completed.
|
int |
getTransactionTimeout()
Returns 0 as timeout feaure is not supported.
|
boolean |
isSameRM(XAResource o)
Checks wether this resource shares the same resource manager
(XAConnection) with an other resource.
|
int |
prepare(Xid xid)
Prepares the resource.
|
Xid[] |
recover(int flag)
Recovers the prepared transactions identifiers.
|
void |
rollback(Xid xid)
Rolls the resource back.
|
boolean |
setTransactionTimeout(int seconds)
Returns
false as timeout feaure is not supported. |
void |
start(Xid xid,
int flag)
Enlists this resource in a given transaction.
|
private boolean enlisted
true
if the resource is enlisted in a transaction.private Xid currentXid
XAResourceMngr rm
Session sess
private static org.objectweb.util.monolog.api.Logger logger
public XAResource(XAResourceMngr rm, Session sess)
public void start(Xid xid, int flag) throws XAException
start
in interface XAResource
XAException
- If the resource is already enlisted in a
transaction, or if the RM fails to enlist the
resource.public void end(Xid xid, int flag) throws XAException
end
in interface XAResource
XAException
- If the resource is not enlisted in the specified
transaction, or if the RM fails to delist the
resource.public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
XAException
- If the RM fails to prepare the resource.public void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
XAException
- If the RM fails to commit the resource.public void rollback(Xid xid) throws XAException
rollback
in interface XAResource
XAException
- If the RM fails to roll the resource back.public Xid[] recover(int flag) throws XAException
recover
in interface XAResource
XAException
- If the RM fails to recover.public void forget(Xid xid) throws XAException
forget
in interface XAResource
XAException
- Always thrown.public boolean setTransactionTimeout(int seconds) throws XAException
false
as timeout feaure is not supported.setTransactionTimeout
in interface XAResource
XAException
- Never thrown.public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
- Never thrown.public boolean isSameRM(XAResource o) throws XAException
isSameRM
in interface XAResource
XAException
- Never thrown.Copyright © 2015 ScalAgent D.T.. All Rights Reserved.