|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jboss.minerva.xa.XAResourceImpl
JTA resource implementation for JDBC 1.0 connections. This is somewhat limited in two respects. First, it does not support two-phase commits since JDBC 1.0 does not. It will operate in the presence of two-phase commits, but will throw heuristic exceptions if there is a failure during a commit or rollback. Second, it can only be associated with one transaction at a time, and will throw exceptions if a second transaction tries to attach before the first has called commit, rollback, or forget.
Warning:
This implementation assumes that forget will be called after a failed commit or rollback. Otherwise, the database connection will never be closed.
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
XAResourceImpl(java.sql.Connection con)
Creates a new instance as the transactional resource for the specified underlying connection. |
Method Summary | |
void |
close()
Closes this instance permanently. |
void |
commit(javax.transaction.xa.Xid id,
boolean twoPhase)
Commits a transaction. |
void |
end(javax.transaction.xa.Xid id,
int flags)
Dissociates a resource from a global transaction. |
void |
forget(javax.transaction.xa.Xid id)
Indicates that no further action will be taken on behalf of this transaction (after a heuristic failure). |
int |
getTransactionTimeout()
Gets the transaction timeout. |
XAConnectionImpl |
getXAConnection()
|
boolean |
isSameRM(javax.transaction.xa.XAResource res)
Since the concept of resource managers does not really apply here (all JDBC connections must be managed individually), indicates whether the specified resource is the same as this one. |
boolean |
isTransaction()
Gets whether there is outstanding work on behalf of a Transaction. |
int |
prepare(javax.transaction.xa.Xid id)
Prepares a transaction to commit. |
javax.transaction.xa.Xid[] |
recover(int flag)
Returns all transaction IDs where work was done with no corresponding commit, rollback, or forget. |
void |
rollback(javax.transaction.xa.Xid id)
Rolls back the work, assuming it was done on behalf of the specified transaction. |
boolean |
setTransactionTimeout(int timeout)
Sets the transaction timeout. |
void |
start(javax.transaction.xa.Xid id,
int flags)
Associates a JDBC connection with a global transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XAResourceImpl(java.sql.Connection con)
Method Detail |
public XAConnectionImpl getXAConnection()
public boolean isTransaction()
public void close()
public void commit(javax.transaction.xa.Xid id, boolean twoPhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (end never called), the
transaction ID is wrong, the connection was set to Auto-Commit,
or the commit on the underlying connection fails. The error code
differs depending on the exact situation.public void end(javax.transaction.xa.Xid id, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (end called twice), or the
transaction ID is wrong.public void forget(javax.transaction.xa.Xid id) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (end never called), or the
transaction ID is wrong.public int getTransactionTimeout() throws javax.transaction.xa.XAException
getTransactionTimeout
in interface javax.transaction.xa.XAResource
public boolean isSameRM(javax.transaction.xa.XAResource res) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
public int prepare(javax.transaction.xa.Xid id) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (end never called), the
transaction ID is wrong, or the connection was set to Auto-Commit.public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
public void rollback(javax.transaction.xa.Xid id) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (end never called), the
transaction ID is wrong, the connection was set to Auto-Commit,
or the rollback on the underlying connection fails. The error code
differs depending on the exact situation.public boolean setTransactionTimeout(int timeout) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
public void start(javax.transaction.xa.Xid id, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- Occurs when the state was not correct (start called twice), the
transaction ID is wrong, or the instance has already been closed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |