JdbcXAConnection

This class provides support for distributed transactions. An application developer usually does not use this interface. It is used by the transaction manager internally.

Methods
void addConnectionEventListener(ConnectionEventListener listener)
Register a new listener for the connection.
void close()
Close the physical connection.
void commit(Xid xid, boolean onePhase)
Commit a transaction.
void end(Xid xid, int flags)
End a transaction.
void forget(Xid xid)
Forget a transaction.
Connection getConnection()
Get a new connection.
int getTransactionTimeout()
Get the transaction timeout.
XAResource getXAResource()
Get the XAResource object.
boolean isSameRM(XAResource xares)
Checks if this is the same XAResource.
int prepare(Xid xid)
Prepare a transaction.
Xid[] recover(int flag)
Get the list of prepared transaction branches.
void removeConnectionEventListener(ConnectionEventListener listener)
Remove the event listener.
void rollback(Xid xid)
Roll back a transaction.
boolean setTransactionTimeout(int seconds)
Set the transaction timeout.
void start(Xid xid, int flags)
Start or continue to work on a transaction.

void addConnectionEventListener(ConnectionEventListener listener)

Register a new listener for the connection.

Parameters:
listener - the event listener

void close() throws SQLException

Close the physical connection. This method is usually called by the connection pool.

Throws:
SQLException

void commit(Xid xid, boolean onePhase) throws XAException

Commit a transaction.

Parameters:
xid - the transaction id
onePhase - use a one-phase protocol if true
Throws:
XAException

void end(Xid xid, int flags) throws XAException

End a transaction.

Parameters:
xid - the transaction id
flags - TMSUCCESS, TMFAIL, or TMSUSPEND
Throws:
XAException

void forget(Xid xid)

Forget a transaction. This method does not have an effect for this database.

Parameters:
xid - the transaction id

Connection getConnection() throws SQLException

Get a new connection. This method is usually called by the connection pool when there are no more connections in the pool.

Returns:
the connection
Throws:
SQLException

int getTransactionTimeout()

Get the transaction timeout.

Returns:
0

XAResource getXAResource()

Get the XAResource object.

Returns:
itself

boolean isSameRM(XAResource xares)

Checks if this is the same XAResource.

Parameters:
xares - the other object
Returns:
true if this is the same object

int prepare(Xid xid) throws XAException

Prepare a transaction.

Parameters:
xid - the transaction id
Throws:
XAException

Xid[] recover(int flag) throws XAException

Get the list of prepared transaction branches. This method is called by the transaction manager during recovery.

Parameters:
flag - TMSTARTRSCAN, TMENDRSCAN, or TMNOFLAGS. If no other flags are set, TMNOFLAGS must be used.
Returns:
zero or more Xid objects
Throws:
XAException

void removeConnectionEventListener(ConnectionEventListener listener)

Remove the event listener.

Parameters:
listener - the event listener

void rollback(Xid xid) throws XAException

Roll back a transaction.

Parameters:
xid - the transaction id
Throws:
XAException

boolean setTransactionTimeout(int seconds)

Set the transaction timeout.

Parameters:
seconds - ignored
Returns:
false

void start(Xid xid, int flags) throws XAException

Start or continue to work on a transaction.

Parameters:
xid - the transaction id
flags - TMNOFLAGS, TMJOIN, or TMRESUME
Throws:
XAException