protected static class LocalXAConnectionFactory.LocalXAResource extends Object implements XAResource
The LocalXAResource also respects the connection read-only setting. If the connection is read-only the commit method will not be called, and the prepare method returns the XA_RDONLY.
It is assumed that the wrapper around a managed connection disables the setAutoCommit(), commit(), rollback() and setReadOnly() methods while a transaction is in progress.TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY| Constructor and Description |
|---|
LocalXAResource(Connection localTransaction) |
| Modifier and Type | Method and Description |
|---|---|
void |
commit(Xid xid,
boolean flag)
Commits the transaction and restores the original auto commit setting.
|
void |
end(Xid xid,
int flag)
This method does nothing.
|
void |
forget(Xid xid)
Clears the currently associated transaction if it is the specified xid.
|
int |
getTransactionTimeout()
Always returns 0 since we have no way to set a transaction timeout on a JDBC connection.
|
Xid |
getXid()
Gets the current xid of the transaction branch associated with this XAResource.
|
boolean |
isSameRM(XAResource xaResource)
Returns true if the specified XAResource == this XAResource.
|
int |
prepare(Xid xid)
This method does nothing since the LocalXAConnection does not support two-phase-commit.
|
Xid[] |
recover(int flag)
Always returns a zero length Xid array.
|
void |
rollback(Xid xid)
Rolls back the transaction and restores the original auto commit setting.
|
boolean |
setTransactionTimeout(int transactionTimeout)
Always returns false since we have no way to set a transaction timeout on a JDBC connection.
|
void |
start(Xid xid,
int flag)
Signals that a the connection has been enrolled in a transaction.
|
public LocalXAResource(Connection localTransaction)
public Xid getXid()
public void start(Xid xid, int flag) throws XAException
start in interface XAResourcexid - the id of the transaction branch for this connectionflag - either XAResource.TMNOFLAGS or XAResource.TMRESUMEXAException - if the connection is already enlisted in another transaction, or if auto-commit could not be
disabledpublic void end(Xid xid, int flag) throws XAException
end in interface XAResourcexid - the id of the transaction branch for this connectionflag - ignoredXAException - if the connection is already enlisted in another transactionpublic int prepare(Xid xid)
prepare in interface XAResourcexid - the id of the transaction branch for this connectionpublic void commit(Xid xid, boolean flag) throws XAException
commit in interface XAResourcexid - the id of the transaction branch for this connectionflag - ignoredXAException - if connection.commit() throws a SQLExceptionpublic void rollback(Xid xid) throws XAException
rollback in interface XAResourcexid - the id of the transaction branch for this connectionXAException - if connection.rollback() throws a SQLExceptionpublic boolean isSameRM(XAResource xaResource)
isSameRM in interface XAResourcexaResource - the XAResource to testpublic void forget(Xid xid)
forget in interface XAResourcexid - the id of the transaction to forgetpublic Xid[] recover(int flag)
recover in interface XAResourceflag - ignored since recovery is not supportedpublic int getTransactionTimeout()
getTransactionTimeout in interface XAResourcepublic boolean setTransactionTimeout(int transactionTimeout)
setTransactionTimeout in interface XAResourcetransactionTimeout - ignored since we have no way to set a transaction timeout on a JDBC connectionCopyright © 2001–2018 The Apache Software Foundation. All rights reserved.