| java.lang.Object com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection com.mysql.jdbc.jdbc2.optional.MysqlXAConnection
MysqlXAConnection | public class MysqlXAConnection extends MysqlPooledConnection implements XAConnection,XAResource(Code) | | An object that provides support for distributed transactions. An
XAConnection object may be enlisted in a distributed
transaction by means of an XAResource object. A transaction
manager, usually part of a middle tier server, manages an
XAConnection object through the XAResource
object.
An application programmer does not use this interface directly; rather, it is
used by a transaction manager working in the middle tier server.
since: 1.4 |
Method Summary | |
public void | commit(Xid xid, boolean onePhase) Commits the global transaction specified by xid.
throws: XAException - An error has occurred. | public void | end(Xid xid, int flags) 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. | public void | forget(Xid xid) Tells the resource manager to forget about a heuristically completed
transaction branch.
throws: XAException - An error has occurred. | public synchronized Connection | getConnection() | public int | getTransactionTimeout() Obtains the current transaction timeout value set for this XAResource
instance. | public XAResource | getXAResource() Retrieves an XAResource object that the transaction
manager will use to manage this XAConnection object's
participation in a distributed transaction. | public boolean | isSameRM(XAResource xares) 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 xares.
true if it's the same RM instance; otherwise false. throws: XAException - An error has occurred. | protected static XAException | mapXAExceptionFromSQLException(SQLException sqlEx) | public int | prepare(Xid xid) Asks the resource manager to prepare for a transaction commit of the
transaction specified in xid.
throws: XAException - An error has occurred. | public Xid[] | recover(int flag) This method is called to obtain a list of prepared transaction branches
from a resource manager. | protected static Xid[] | recover(Connection c, int flag) | public void | rollback(Xid xid) Informs the resource manager to roll back work done on behalf of a
transaction branch.
throws: XAException - An error has occurred. | public boolean | setTransactionTimeout(int arg0) Sets the current transaction timeout value for this XAResource instance.
Once set, this timeout value is effective until setTransactionTimeout is
invoked again with a different value.
To reset the timeout value to the default value used by the resource
manager, set the value to zero. | public void | start(Xid xid, int flags) 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.
throws: XAException - An error has occurred. |
logXaCommands | protected boolean logXaCommands(Code) | | |
commit | public void commit(Xid xid, boolean onePhase) throws XAException(Code) | | Commits the global transaction specified by xid.
throws: XAException - 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.If the resource manager did not commit the transaction and the parameteronePhase is set to true, the resource manager may throw one of the XA_RB*exceptions.Upon return, the resource manager has rolled back the branch's work andhas released all held resources. |
end | public void end(Xid xid, int flags) throws XAException(Code) | | 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.
throws: XAException - -An error has occurred. Possible XAException values areXAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, XAER_PROTO,or XA_RB*. |
forget | public void forget(Xid xid) throws XAException(Code) | | Tells the resource manager to forget about a heuristically completed
transaction branch.
throws: XAException - An error has occurred. Possible exception values areXAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, orXAER_PROTO. |
getTransactionTimeout | public int getTransactionTimeout() throws XAException(Code) | | Obtains the current transaction timeout value set for this XAResource
instance. If XAResource.setTransactionTimeout was not used prior to
invoking this method, the return value is the default timeout set for the
resource manager; otherwise, the value used in the previous
setTransactionTimeout call is returned.
the transaction timeout value in seconds. throws: XAException - An error has occurred. Possible exception values areXAER_RMERR and XAER_RMFAIL. |
getXAResource | public XAResource getXAResource() throws SQLException(Code) | | Retrieves an XAResource object that the transaction
manager will use to manage this XAConnection object's
participation in a distributed transaction.
the XAResource object exception: SQLException - if a database access error occurs |
isSameRM | public boolean isSameRM(XAResource xares) throws XAException(Code) | | 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 xares.
true if it's the same RM instance; otherwise false. throws: XAException - An error has occurred. Possible exception values areXAER_RMERR and XAER_RMFAIL. |
prepare | public int prepare(Xid xid) throws XAException(Code) | | Asks the resource manager to prepare for a transaction commit of the
transaction specified in xid.
throws: XAException - An error has occurred. Possible exception values are: XA_RB*,XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, orXAER_PROTO. |
recover | public Xid[] recover(int flag) throws XAException(Code) | | This method is called to obtain 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.
The flag parameter indicates where the recover scan should start or end,
or start and end. This method may be invoked one or more times during a
recovery scan. The resource manager maintains a cursor which marks the
current position of the prepared or heuristically completed transaction list.
Each invocation of the recover method moves the cursor passed the set of Xids
that are returned.
Two consecutive invocation of this method that starts from the
beginning of the list must return the same list of transaction branches
unless one of the following takes place:
- the transaction manager invokes the commit, forget, prepare, or rollback method for that resource
manager, between the two consecutive invocation of the recovery scan.
- the resource manager heuristically completes some transaction branches
between the two invocation of the recovery scan.
Parameters: flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must beused when no other flags are set in the parameter. throws: XAException - An error has occurred. Possible values are XAER_RMERR,XAER_RMFAIL, XAER_INVAL, and XAER_PROTO. |
rollback | public void rollback(Xid xid) throws XAException(Code) | | Informs the resource manager to roll back work done on behalf of a
transaction branch.
throws: XAException - 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.If the transaction branch is already marked rollback-only the resourcemanager may throw one of the XA_RB* exceptions.Upon return, the resource manager has rolled back the branch's work andhas released all held resources. |
setTransactionTimeout | public boolean setTransactionTimeout(int arg0) throws XAException(Code) | | Sets the current transaction timeout value for this XAResource instance.
Once set, this timeout value is effective until setTransactionTimeout is
invoked again with a different value.
To reset the timeout value to the default value used by the resource
manager, set the value to zero. If the timeout operation is performed
successfully, the method returns true; otherwise false.
If a resource manager does not support explicitly setting the transaction
timeout value, this method returns false.
true if the transaction timeout value is set successfully;otherwise false. throws: XAException - An error has occurred. Possible exception values areXAER_RMERR, XAER_RMFAIL, or XAER_INVAL. |
start | public void start(Xid xid, int flags) throws XAException(Code) | | 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.
throws: XAException - An error has occurred. Possible exceptions are XA_RB*,XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA,XAER_INVAL, or XAER_PROTO. |
Fields inherited from com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection | final public static int CONNECTION_CLOSED_EVENT(Code)(Java Doc) final public static int CONNECTION_ERROR_EVENT(Code)(Java Doc)
|
|
|