| javax.transaction.xa.XAResource
XAResource | public interface XAResource (Code) | | An interface which provides a mapping of the X/Open CAE Specification (for
Distributed Transaction processing) into Java. The XAResource interface is
used as the interface between a Transaction Manager and a Resource Manager
for handling distributed transaction processing.
Typically, a JDBC driver or a JMS driver will implement the XAResource
interface to support Global Transactions on a database or on a message
connection.
|
Field Summary | |
final public static int | TMENDRSCAN | final public static int | TMFAIL | final public static int | TMJOIN Flag to indicate that the caller is joining sn existing transaction
branch. | final public static int | TMNOFLAGS Flag that indicates that no flags options are selected. | final public static int | TMONEPHASE | final public static int | TMRESUME | final public static int | TMSTARTRSCAN | final public static int | TMSUCCESS | final public static int | TMSUSPEND Flag that indicates that the caller is suspending (not terminating) its
association with a transaction branch. | final public static int | XA_OK | final public static int | XA_RDONLY |
Method Summary | |
public void | commit(Xid xid, boolean onePhase) Commits a global transaction.
Parameters: xid - the XID which identifies the global transaction Parameters: onePhase - true if the resource manager should use a one-phase commitprotocol to commit the transaction throws: XAException - if an error occurred.Possible errors are identified by the errorcode in theXAException and include: 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 flags) Ends the work done for a transaction branch. | public void | forget(Xid xid) Informs the Resource Manager that it can forget about a specified
transaction branch.
Parameters: xid - the XID which identifies the global transaction. throws: XAException - if an error occurs. | public int | getTransactionTimeout() Gets the transaction timeout value for this XAResource. | public boolean | isSameRM(XAResource theXAResource) Returns true if the ResourceManager for this XAResource is the same as
the Resource Manager for a supplied XAResource.
Parameters: theXAResource - an XAResource object true if the Resource Manager for this XAResource is the same asthe Resource Manager for theXAResource . throws: XAException - if an error occurs. | public int | prepare(Xid xid) Requests the Resource manager to prepare to commit a specified
transaction.
Parameters: xid - the XID which identifies the global transaction. | public Xid[] | recover(int flag) Get a list of prepared transaction branches.
Typically used by a transaction manager during recovery to find
transaction branches that are in prepared or heuristically completed
states.
Parameters: flag - an integer. | public void | rollback(Xid xid) Requests the Resource Manager to rollback a specified transaction branch. | public boolean | setTransactionTimeout(int seconds) Sets the transaction timeout value for this XAResource. | public void | start(Xid xid, int flags) Starts work for a specified transaction branch.
Parameters: xid - the XID which identifies the transaction branch. Parameters: flags - an integer. |
TMENDRSCAN | final public static int TMENDRSCAN(Code) | | Flag to end a recovery scan
|
TMFAIL | final public static int TMFAIL(Code) | | Flag to indicate that the caller is dissociation from a transaction
branch and that it should be marked rollback only
|
TMJOIN | final public static int TMJOIN(Code) | | Flag to indicate that the caller is joining sn existing transaction
branch.
|
TMNOFLAGS | final public static int TMNOFLAGS(Code) | | Flag that indicates that no flags options are selected. (ie a null flag)
|
TMONEPHASE | final public static int TMONEPHASE(Code) | | Flag that indicates the caller is using one-phase commit optimization
|
TMRESUME | final public static int TMRESUME(Code) | | Flag that indicates the caller is resuming association with a suspended
transaction branch
|
TMSTARTRSCAN | final public static int TMSTARTRSCAN(Code) | | Flag that indicates the start of a recovery scan
|
TMSUCCESS | final public static int TMSUCCESS(Code) | | Flag that indicates the caller is dissociating from a transaction branch
|
TMSUSPEND | final public static int TMSUSPEND(Code) | | Flag that indicates that the caller is suspending (not terminating) its
association with a transaction branch.
|
XA_OK | final public static int XA_OK(Code) | | Flag that indicates that transaction work has been Prepared normally
|
XA_RDONLY | final public static int XA_RDONLY(Code) | | Flag that indicates that transaction work has been read only and has been
committed normally
|
commit | public void commit(Xid xid, boolean onePhase) throws XAException(Code) | | Commits a global transaction.
Parameters: xid - the XID which identifies the global transaction Parameters: onePhase - true if the resource manager should use a one-phase commitprotocol to commit the transaction throws: XAException - if an error occurred.Possible errors are identified by the errorcode in theXAException and include: XA_HEURHAZ, XA_HEURCOM, XA_HEURRB,XA_HEURMIX, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,or XAER_PROTO. In addition, one of the XA_RB* errors canoccur if the transaction was not committed andonePhase was set to true. On completion ofthis method, the Resource Manager has rolled back thetransaction and released resources held by the transaction. |
end | public void end(Xid xid, int flags) throws XAException(Code) | | Ends the work done for a transaction branch. The Resource Manager
disconnects the XA resource from the transaction branch and allows the
transaction to complete.
Parameters: xid - the XID which identifies the global transaction. Should havepreviously been used as the parameter to a start method. Parameters: flags - a flags integer - one of: XAResource.TMSUCCESS,XAResource.TMFAIL, or XAResource.TMSUSPEND.TMSUCCESS means that this section of work completedsuccessfully. TMFAIL means that this section of work failed. The ResourceManager can mark the transaction for rollback only. TMSUSPEND means that this section of work is suspended and notyet complete. The associated transaction context is alsosuspended and must be restarted with a call toXAResource.start(Xid,int) with the TMRESUME flag. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR, XAER_RMFAIL, XAER_NOTA,XAER_INVAL, XAER_PROTO, or XA_RB*. |
forget | public void forget(Xid xid) throws XAException(Code) | | Informs the Resource Manager that it can forget about a specified
transaction branch.
Parameters: xid - the XID which identifies the global transaction. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR, XAER_RMFAIL, XAER_NOTA,XAER_INVAL, or XAER_PROTO. |
getTransactionTimeout | public int getTransactionTimeout() throws XAException(Code) | | Gets the transaction timeout value for this XAResource. The default
timeout value is the default timeout value set for the Resource Manager.
the transaction timeout value for this XAResource in seconds. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR and XAER_RMFAIL. |
isSameRM | public boolean isSameRM(XAResource theXAResource) throws XAException(Code) | | Returns true if the ResourceManager for this XAResource is the same as
the Resource Manager for a supplied XAResource.
Parameters: theXAResource - an XAResource object true if the Resource Manager for this XAResource is the same asthe Resource Manager for theXAResource . throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR and XAER_RMFAIL. |
prepare | public int prepare(Xid xid) throws XAException(Code) | | Requests the Resource manager to prepare to commit a specified
transaction.
Parameters: xid - the XID which identifies the global transaction. an integer: XA_RDONLY or XA_OK. XA_OK implies that thetransaction work has been prepared normally, XA_RDONLY impliesthat the transaction branch is read only and has been committed.If there is a failure which requires a rollback, an XAExceptionis raised. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XA_RB*, XAER_RMERR, XAER_RMFAIL,XAER_NOTA, XAER_INVAL, or XAER_PROTO. |
recover | public Xid[] recover(int flag) throws XAException(Code) | | Get a list of prepared transaction branches.
Typically used by a transaction manager during recovery to find
transaction branches that are in prepared or heuristically completed
states.
Parameters: flag - an integer. Must be one of: XAResource.TMSTARTRSCAN,XAResource.TMENDRSCAN, XAResource.TMNOFLAGS. an array of zero or more XIDs identifying the transactionbranches in the prepared or heuristically completed states. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR, XAER_RMFAIL, XAER_INVAL, andXAER_PROTO. |
rollback | public void rollback(Xid xid) throws XAException(Code) | | Requests the Resource Manager to rollback a specified transaction branch.
Parameters: xid - the XID which identifies the transaction branch. throws: XAException - if an error occurs. |
setTransactionTimeout | public boolean setTransactionTimeout(int seconds) throws XAException(Code) | | Sets the transaction timeout value for this XAResource. If the value is
set to 0, the default timeout value for the Resource Manager is used.
Parameters: seconds - the new Timeout value in seconds true if the transaction timeout value has been updated, falseotherwise. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XAER_RMERR, XAER_RMFAIL, or XAER_INVAL. |
start | public void start(Xid xid, int flags) throws XAException(Code) | | Starts work for a specified transaction branch.
Parameters: xid - the XID which identifies the transaction branch. Parameters: flags - an integer. Must be one of XAResource.TMNOFLAGS,XAResource.TMJOIN, or XAResource.TMRESUME.TMJOIN implies that the start applies to joining a transactionpreviously passed to the Resource Manager. TMRESUME implies that the start applies to a suspendedtransaction that should be restarted. If TMNOFLAGS is specified, then if the transaction has beenpreviously seen by the Resource Manager, an XAException israised with the code XAER_DUPID. throws: XAException - if an error occurs. Possible error identified in theerrorcode include: XA_RB*, XAER_RMERR, XAER_RMFAIL,XAER_DUPID, XAER_OUTSIDE, XAER_NOTA, XAER_INVAL, orXAER_PROTO. |
|
|