|
MySQL Connector/J size='-1'>5.1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.jdbc2.optional.MysqlPooledConnection
com.mysql.jdbc.jdbc2.optional.MysqlXAConnection
public class MysqlXAConnection
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.
Field Summary | |
---|---|
protected boolean |
logXaCommands
|
Fields inherited from class com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection |
---|
CONNECTION_CLOSED_EVENT, CONNECTION_ERROR_EVENT |
Fields inherited from interface javax.transaction.xa.XAResource |
---|
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
---|---|
MysqlXAConnection(ConnectionImpl connection,
boolean logXaCommands)
|
Method Summary | |
---|---|
void |
addStatementEventListener(javax.sql.StatementEventListener listener)
|
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
Commits the global transaction specified by xid. |
void |
end(javax.transaction.xa.Xid xid,
int flags)
Ends the work performed on behalf of a transaction branch. |
void |
forget(javax.transaction.xa.Xid xid)
Tells the resource manager to forget about a heuristically completed transaction branch. |
java.sql.Connection |
getConnection()
Invoked by the container. |
protected static MysqlXAConnection |
getInstance(ConnectionImpl mysqlConnection,
boolean logXaCommands)
|
int |
getTransactionTimeout()
Obtains the current transaction timeout value set for this XAResource instance. |
javax.transaction.xa.XAResource |
getXAResource()
Retrieves an XAResource object that the transaction
manager will use to manage this XAConnection object's
participation in a distributed transaction. |
boolean |
isSameRM(javax.transaction.xa.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. |
protected static javax.transaction.xa.XAException |
mapXAExceptionFromSQLException(java.sql.SQLException sqlEx)
|
int |
prepare(javax.transaction.xa.Xid xid)
Asks the resource manager to prepare for a transaction commit of the transaction specified in xid. |
protected static javax.transaction.xa.Xid[] |
recover(java.sql.Connection c,
int flag)
|
javax.transaction.xa.Xid[] |
recover(int flag)
This method is called to obtain a list of prepared transaction branches from a resource manager. |
void |
removeStatementEventListener(javax.sql.StatementEventListener listener)
|
void |
rollback(javax.transaction.xa.Xid xid)
Informs the resource manager to roll back work done on behalf of a transaction branch. |
boolean |
setTransactionTimeout(int arg0)
Sets the current transaction timeout value for this XAResource instance. |
void |
start(javax.transaction.xa.Xid xid,
int flags)
Starts work on behalf of a transaction branch specified in xid. |
Methods inherited from class com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection |
---|
addConnectionEventListener, callConnectionEventListeners, close, getConnection, getInstance, removeConnectionEventListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sql.PooledConnection |
---|
addConnectionEventListener, close, removeConnectionEventListener |
Field Detail |
---|
protected boolean logXaCommands
Constructor Detail |
---|
public MysqlXAConnection(ConnectionImpl connection, boolean logXaCommands) throws java.sql.SQLException
connection
-
java.sql.SQLException
Method Detail |
---|
protected static MysqlXAConnection getInstance(ConnectionImpl mysqlConnection, boolean logXaCommands) throws java.sql.SQLException
java.sql.SQLException
public javax.transaction.xa.XAResource getXAResource() throws java.sql.SQLException
XAResource
object that the transaction
manager will use to manage this XAConnection
object's
participation in a distributed transaction.
getXAResource
in interface javax.sql.XAConnection
XAResource
object
java.sql.SQLException
- if a database access error occurspublic int getTransactionTimeout() throws javax.transaction.xa.XAException
getTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception values are
XAER_RMERR and XAER_RMFAIL.public boolean setTransactionTimeout(int arg0) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception values are
XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.public boolean isSameRM(javax.transaction.xa.XAResource xares) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception values are
XAER_RMERR and XAER_RMFAIL.public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be
used when no other flags are set in the parameter.
javax.transaction.xa.XAException
- An error has occurred. Possible values are XAER_RMERR,
XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.protected static javax.transaction.xa.Xid[] recover(java.sql.Connection c, int flag) throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception values are: XA_RB*,
XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
XAER_PROTO.public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception values are
XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
XAER_PROTO.public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
javax.transaction.xa.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 resource
manager may throw one of the XA_RB* exceptions.
Upon return, the resource manager has rolled back the branch's work and
has released all held resources.public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- -
An error has occurred. Possible XAException values are
XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, XAER_PROTO,
or XA_RB*.public void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
javax.transaction.xa.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.public void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
javax.transaction.xa.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 parameter
onePhase 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 and
has released all held resources.protected static javax.transaction.xa.XAException mapXAExceptionFromSQLException(java.sql.SQLException sqlEx)
public java.sql.Connection getConnection() throws java.sql.SQLException
MysqlPooledConnection
getConnection
in interface javax.sql.PooledConnection
getConnection
in class MysqlPooledConnection
java.sql.SQLException
java.sql.DataSource#getConnection()
public void addStatementEventListener(javax.sql.StatementEventListener listener)
addStatementEventListener
in interface javax.sql.PooledConnection
addStatementEventListener
in class MysqlPooledConnection
public void removeStatementEventListener(javax.sql.StatementEventListener listener)
removeStatementEventListener
in interface javax.sql.PooledConnection
removeStatementEventListener
in class MysqlPooledConnection
|
MySQL Connector/J size='-1'>5.1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |