public class MariaXaResource extends Object implements XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Constructor and Description |
---|
MariaXaResource(MariaDbConnection connection) |
Modifier and Type | Method and Description |
---|---|
void |
commit(Xid xid,
boolean onePhase)
Commits the global transaction specified by xid.
|
void |
end(Xid xid,
int flags)
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.
|
int |
getTransactionTimeout()
Obtains the current transaction timeout value set for this XAResource instance.
|
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 resource manager instance represented by the parameter xares.
|
int |
prepare(Xid xid)
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
|
Xid[] |
recover(int flags)
Obtains a list of prepared transaction branches from a resource manager.
|
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 flags)
Starts work on behalf of a transaction branch specified in xid.
|
public MariaXaResource(MariaDbConnection connection)
public void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
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.XAException
- exceptionpublic void end(Xid xid, int flags) throws XAException
If TMSUSPEND is specified in the flags, the transaction branch is temporarily suspended in an incomplete state. The transaction context is in a suspended state and must be resumed via the start method with TMRESUME specified.
If TMFAIL is specified, the portion of work has failed. The resource manager may mark the transaction as rollback-only
If TMSUCCESS is specified, the portion of work has completed successfully.
end
in interface XAResource
xid
- A global transaction identifier that is the same as the identifier used previously in the start method.flags
- One of TMSUCCESS, TMFAIL, or TMSUSPEND.XAException
- An error has occurred. (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
- A global transaction identifier.XAException
- 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 and 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 target object.XAException
- An error has occurred. Possible exception values are XAER_RMERR and XAER_RMFAIL.public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
xid
- A global transaction identifier.XAException
- An error has occurred. Possible exception values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, XAER_PROTO.public Xid[] recover(int flags) throws XAException
recover
in interface XAResource
flags
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter.XAException
- An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.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 flags) throws XAException
start
in interface XAResource
xid
- A global transaction identifier to be associated with the resource.flags
- One of TMNOFLAGS, TMJOIN, or TMRESUME.XAException
- An error has occurred.Copyright © 2016. All rights reserved.