public class XAResourceImpl extends Object implements AMQXAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Modifier | Constructor and Description |
---|---|
protected |
XAResourceImpl(XASessionImpl xaSession)
Create an XAResource associated with a XASession
|
Modifier and Type | Method and Description |
---|---|
void |
commit(Xid xid,
boolean b)
Commits the global transaction specified by xid.
|
void |
end(Xid xid,
int flag)
Ends the work performed on behalf of a transaction branch.
|
void |
forget(Xid xid)
Tells the resource manager to forget about a heuristically completed transaction branch.
|
String |
getBrokerUUID() |
List<XAResource> |
getSiblings() |
int |
getTransactionTimeout()
Obtains the current transaction timeout value set for this XAResource instance.
|
boolean |
isEnlisted()
Is this resource currently enlisted in a transaction?
|
boolean |
isSameRM(XAResource xaResource)
This method is called to determine if the resource manager instance represented
by the target object is the same as the resouce manager instance represented by
the parameter xaResource.
|
int |
prepare(Xid xid)
Prepare for a transaction commit of the transaction specified in
Xid . |
Xid[] |
recover(int flag)
Obtains a list of prepared transaction branches.
|
void |
rollback(Xid xid)
Informs the resource manager to roll back work done on behalf of a transaction branch
|
boolean |
setTransactionTimeout(int timeout)
Sets the current transaction timeout value for this XAResource instance.
|
void |
start(Xid xid,
int flag)
Starts work on behalf of a transaction branch specified in xid.
|
protected XAResourceImpl(XASessionImpl xaSession)
xaSession
- The session XAresourcepublic void commit(Xid xid, boolean b) throws XAException
commit
in interface XAResource
xid
- A global transaction identifierb
- If true, use a one-phase commit protocol to commit the work done on behalf of xid.XAException
- An error has occurred. An error has occurred. Possible XAExceptions are XA_HEURHAZ,
XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public void end(Xid xid, int flag) throws XAException
end
in interface XAResource
xid
- A global transaction identifier that is the same as the identifier used previously in the start methodflag
- One of TMSUCCESS, TMFAIL, or TMSUSPEND.XAException
- An error has occurred. An error has occurred. Possible XAException values are XAER_RMERR,
XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB*.public void forget(Xid xid) throws XAException
forget
in interface XAResource
xid
- String(xid.getGlobalTransactionId() A global transaction identifierXAException
- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL,
XAER_NOTA, XAER_INVAL, or XAER_PROTO.public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL.public boolean isSameRM(XAResource xaResource) throws XAException
isSameRM
in interface XAResource
xaResource
- An XAResource object whose resource manager instance is to
be compared with the resource manager instance of the target objecttrue
if it's the same RM instance; otherwise false
.XAException
- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL.public int prepare(Xid xid) throws XAException
Xid
.prepare
in interface XAResource
xid
- A global transaction identifier.XAException
- An error has occurred. Possible exception values are: XAER_RMERR or XAER_NOTApublic Xid[] recover(int flag) throws XAException
The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.
recover
in interface XAResource
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS.
TMNOFLAGS must be used when no other flags are set in the parameter.XAException
- An error has occurred. Possible value is XAER_INVAL.public void rollback(Xid xid) throws XAException
rollback
in interface XAResource
xid
- A global transaction identifier.XAException
- An error has occurred.public boolean setTransactionTimeout(int timeout) throws XAException
setTransactionTimeout
in interface XAResource
timeout
- The transaction timeout value in seconds.XAException
- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.public void start(Xid xid, int flag) throws XAException
start
in interface XAResource
xid
- A global transaction identifier to be associated with the resourceflag
- One of TMNOFLAGS, TMJOIN, or TMRESUMEXAException
- An error has occurred. Possible exceptions
are XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public boolean isEnlisted()
public String getBrokerUUID()
getBrokerUUID
in interface AMQXAResource
public List<XAResource> getSiblings()
getSiblings
in interface AMQXAResource
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.