protected static class LocalXAConnectionFactory.LocalXAResource
extends java.lang.Object
implements javax.transaction.xa.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.Constructor and Description |
---|
LocalXAResource(java.sql.Connection localTransaction) |
Modifier and Type | Method and Description |
---|---|
void |
commit(javax.transaction.xa.Xid xid,
boolean flag)
Commits the transaction and restores the original auto commit setting.
|
void |
end(javax.transaction.xa.Xid xid,
int flag)
This method does nothing.
|
void |
forget(javax.transaction.xa.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.
|
javax.transaction.xa.Xid |
getXid()
Gets the current xid of the transaction branch associated with this XAResource.
|
boolean |
isSameRM(javax.transaction.xa.XAResource xaResource)
Returns true if the specified XAResource == this XAResource.
|
int |
prepare(javax.transaction.xa.Xid xid)
This method does nothing since the LocalXAConnection does not support two-phase-commit.
|
javax.transaction.xa.Xid[] |
recover(int flag)
Always returns a zero length Xid array.
|
void |
rollback(javax.transaction.xa.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(javax.transaction.xa.Xid xid,
int flag)
Signals that a the connection has been enrolled in a transaction.
|
public javax.transaction.xa.Xid getXid()
public void start(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction branch for this connectionflag
- either XAResource.TMNOFLAGS or XAResource.TMRESUMEjavax.transaction.xa.XAException
- if the connection is already enlisted in another transaction, or if auto-commit could not be
disabledpublic void end(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction branch for this connectionflag
- ignoredjavax.transaction.xa.XAException
- if the connection is already enlisted in another transactionpublic int prepare(javax.transaction.xa.Xid xid)
prepare
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction branch for this connectionpublic void commit(javax.transaction.xa.Xid xid, boolean flag) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction branch for this connectionflag
- ignoredjavax.transaction.xa.XAException
- if connection.commit() throws a SQLExceptionpublic void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction branch for this connectionjavax.transaction.xa.XAException
- if connection.rollback() throws a SQLExceptionpublic boolean isSameRM(javax.transaction.xa.XAResource xaResource)
isSameRM
in interface javax.transaction.xa.XAResource
xaResource
- the XAResource to testpublic void forget(javax.transaction.xa.Xid xid)
forget
in interface javax.transaction.xa.XAResource
xid
- the id of the transaction to forgetpublic javax.transaction.xa.Xid[] recover(int flag)
recover
in interface javax.transaction.xa.XAResource
flag
- ignored since recovery is not supportedpublic int getTransactionTimeout()
getTransactionTimeout
in interface javax.transaction.xa.XAResource
public boolean setTransactionTimeout(int transactionTimeout)
setTransactionTimeout
in interface javax.transaction.xa.XAResource
transactionTimeout
- ignored since we have no way to set a transaction timeout on a JDBC connectionCopyright © 2000-2022 Apache Software Foundation. All Rights Reserved.