Package com.franz.agraph.repository
Class AGXAResource
java.lang.Object
com.franz.agraph.repository.AGXAResource
- All Implemented Interfaces:
XAResource
-
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Disassociate the transaction (identified by xid) from the resource Ends the work performed on behalf of a transaction branch.void
int
boolean
isSameRM
(XAResource xares) This method must return true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing.int
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.Xid[]
recover
(int flag) Obtains a list of prepared transaction branches from a resource manager.void
boolean
setTransactionTimeout
(int seconds) void
Starts work on behalf of a transaction branch specified in xid.
-
Constructor Details
-
AGXAResource
-
-
Method Details
-
start
Starts work on behalf of a transaction branch specified in xid. If TMJOIN is specified, the start applies to joining a transaction previously seen by the resource manager. If TMRESUME is specified, the start applies to resuming a suspended transaction specified in the parameter xid. If neither TMJOIN nor TMRESUME is specified and the transaction specified by xid has previously been seen by the resource manager, the resource manager throws the XAException exception with XAER_DUPID error code.- Specified by:
start
in interfaceXAResource
- Parameters:
xid
- A global transaction identifier to be associated with the resource.flags
- One of TMNOFLAGS, TMJOIN, or TMRESUME.- Throws:
XAException
-
end
Disassociate the transaction (identified by xid) from the resource Ends the work performed on behalf of a transaction branch. The resource manager disassociates the XA resource from the transaction branch specified and lets the transaction complete. 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.- Specified by:
end
in interfaceXAResource
- Parameters:
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.- Throws:
XAException
-
rollback
- Specified by:
rollback
in interfaceXAResource
- Throws:
XAException
-
prepare
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.- Specified by:
prepare
in interfaceXAResource
- Parameters:
xid
- The global transaction identifier to assign to the prepared commit.- Returns:
- A value indicating the resource manager's vote on the outcome of the transaction. The possible values are: XA_RDONLY or XA_OK. If the resource manager wants to roll back the transaction, it should do so by raising an appropriate XAException in the prepare method.
- Throws:
XAException
- An error has occurred. Possible exception values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
-
commit
- Specified by:
commit
in interfaceXAResource
- Throws:
XAException
-
forget
- Specified by:
forget
in interfaceXAResource
- Throws:
XAException
-
isSameRM
This method must return true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing. We compare storeIDs to make that determination.- Specified by:
isSameRM
in interfaceXAResource
- Parameters:
xares
- The XAResource to compare with.- Returns:
- true if xares and 'this' correspond to the same repository, regardless of how the connection is made or who is accessing.
- Throws:
XAException
-
recover
Obtains a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.- Specified by:
recover
in interfaceXAResource
- Parameters:
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter.- Returns:
- An array of zero or more XIDs of the transaction branches that are currently in a prepared or heuristically completed state. If an error occurs during the operation, the resource manager should throw the appropriate XAException.
- Throws:
XAException
- An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
-
getTransactionTimeout
- Specified by:
getTransactionTimeout
in interfaceXAResource
- Throws:
XAException
-
setTransactionTimeout
- Specified by:
setTransactionTimeout
in interfaceXAResource
- Throws:
XAException
-