XAResource
OracleXAResource
public abstract class OracleXAResource extends Object implements XAResource
Modifier and Type | Field | Description |
---|---|---|
protected Xid |
activeXid |
|
protected boolean |
canBeMigratablySuspended |
|
protected Connection |
connection |
|
protected String |
dblink |
|
static short |
DEFAULT_XA_TIMEOUT |
|
static int |
ORAISOLATIONMASK |
|
static int |
ORATMREADONLY |
|
static int |
ORATMREADWRITE |
|
static int |
ORATMSERIALIZABLE |
|
static int |
ORATRANSLOOSE |
|
protected boolean |
savedConnectionAutoCommit |
|
protected boolean |
savedXAConnectionAutoCommit |
|
protected int |
timeout |
|
static int |
TMENDRSCAN |
|
static int |
TMFAIL |
|
static int |
TMJOIN |
|
static int |
TMMIGRATE |
|
static int |
TMNOFLAGS |
|
static int |
TMNOMIGRATE |
|
static int |
TMONEPHASE |
|
static int |
TMPROMOTE |
|
static int |
TMRESUME |
|
static int |
TMSTARTRSCAN |
|
static int |
TMSUCCESS |
|
static int |
TMSUSPEND |
|
static int |
XA_OK |
|
protected OracleXAConnection |
xaconnection |
|
protected Hashtable<Xid,oracle.jdbc.xa.OracleXAResource.XidListEntry> |
xidHash |
XA_RDONLY
Constructor | Description |
---|---|
OracleXAResource() |
|
OracleXAResource(Connection pm_conn, OracleXAConnection xaconn) |
OracleXAResource() -- The initializer.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
allowGlobalTxnModeOnly(int errorCode) |
|
protected void |
checkError(int error) |
|
protected void |
checkError(int error, int defaultXAError) |
|
protected void |
checkError(int error, SQLException sqlException) |
|
protected void |
checkError(SQLException sqlex, int defaultXAError) |
|
abstract void |
commit(Xid xid, boolean onePhase) |
commit() -- Commit work done by global transaction specified by xid.
|
protected void |
createOrUpdateXid(Xid xid, boolean isSuspended, boolean[] isLocallySuspended) |
craeteOrUpdateXid () - Pushes the current xid.
|
protected void |
debug(Logger logger, Level level, Executable method, String msg) |
|
abstract void |
end(Xid xid, int flag) |
end()-- End work performed on behalf of a transaction branch.
|
protected void |
enterGlobalTxnMode() |
|
protected void |
exitGlobalTxnMode() |
|
abstract void |
forget(Xid xid) |
forget() -- Tell RM to forget about a heuristically completed txn branch
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling() |
|
int |
getTransactionTimeout() |
Obtain the current transaction timeout value set for this XAResource instance.
|
protected boolean |
isOnStack(Xid xid) |
|
boolean |
isSameRM(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 boolean |
isXidListEmpty() |
|
protected boolean |
isXidSuspended(Xid xid) |
isXidSuspended(Xid) - Checks if the passed Xid is suspended or not.
|
abstract int |
prepare(Xid xid) |
prepare() -- Ask RM to prepare for a commit of the txn specified in xid.
|
Xid[] |
recover(int flag) |
Obtain a list of prepared transaction branches from a resource manager.
|
protected boolean |
removeXidFromList(Xid xid) |
|
protected void |
restoreAutoCommitModeForGlobalTransaction() |
Restore the auto-commit status of the Connection & the PooledConnection.
|
protected void |
resumeStacked(Xid xid) |
resumeStacked() - Resumes the current transaction after the possible suspension of the stacked transaction, if any.
|
abstract void |
rollback(Xid xid) |
rollback() -- Ask RM to roll back work done on behalf of a txn branch.
|
protected void |
saveAndAlterAutoCommitModeForGlobalTransaction() |
Save the auto-commit status of the Connection & the PooledConnection.
|
boolean |
setTransactionTimeout(int seconds) |
Set the current transaction timeout value for this XAResource instance.
|
abstract void |
start(Xid xid, int flag) |
start() -- Starts work on behalf of a transaction branch.
|
protected Xid |
suspendStacked(Xid xid) |
suspendStacked() - Suspends the stacked transaction, if any.
|
protected boolean |
updateXidList(Xid xid, boolean[] flags) |
updateXidList() - Update the Xid status in the list
|
public static final int XA_OK
public static final short DEFAULT_XA_TIMEOUT
protected boolean savedConnectionAutoCommit
protected boolean savedXAConnectionAutoCommit
public static final int TMNOFLAGS
public static final int TMNOMIGRATE
public static final int TMENDRSCAN
public static final int TMPROMOTE
public static final int TMFAIL
public static final int TMMIGRATE
public static final int TMJOIN
public static final int TMONEPHASE
public static final int TMRESUME
public static final int TMSTARTRSCAN
public static final int TMSUCCESS
public static final int TMSUSPEND
public static final int ORATMREADONLY
public static final int ORATMREADWRITE
public static final int ORATMSERIALIZABLE
public static final int ORAISOLATIONMASK
public static final int ORATRANSLOOSE
protected Connection connection
protected OracleXAConnection xaconnection
protected int timeout
protected String dblink
protected boolean canBeMigratablySuspended
protected Xid activeXid
public OracleXAResource()
public OracleXAResource(Connection pm_conn, OracleXAConnection xaconn) throws XAException
XAException
- throws an exception if the connection object is null.protected final boolean removeXidFromList(Xid xid)
protected final boolean isOnStack(Xid xid) throws XAException
XAException
protected final boolean isXidListEmpty()
protected void createOrUpdateXid(Xid xid, boolean isSuspended, boolean[] isLocallySuspended)
xid
- Xid to save.protected boolean updateXidList(Xid xid, boolean[] flags)
protected boolean isXidSuspended(Xid xid) throws XAException
XAException
- if the suspend operation fails.protected Xid suspendStacked(Xid xid) throws XAException
xid
- Xid of current transaction. If this is different from the stacked Xid, the stacked Xid will be suspended, clearing the way for the current operation.XAException
- if the suspend operation fails.protected void resumeStacked(Xid xid) throws XAException
xid
- Xid of stacked transaction. If null, then this is a no-op.XAException
- if the resume operation fails.public abstract void start(Xid xid, int flag) throws XAException
start
in interface XAResource
xid
- A global transaction identifier.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 abstract void end(Xid xid, int flag) throws XAException
end
in interface XAResource
xid
- A global transaction identifier that is the same as what was used previously in the start method.flag
- One of TMSUCCESS, TMFAIL, or TMSUSPEND.XAException
- An error has occurred. Possible XAException values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB.public abstract void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
xid
- A global transaction identifier.onePhase
- If true, the RM should use a 1-phase commit protocol to commit the work done on behalf of xid.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 txn and the paramether onePhase is set to true, the RM may raise one of the XA_RB exceptions. Upon return, the RM has rolled back the branch's work and has released all held resources.public abstract int prepare(Xid xid) throws XAException
prepare
in interface XAResource
xid
- A global transaction identifier.XAException
- (An error has occurred.) Possible exception values are: XA_RB, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public abstract void forget(Xid xid) throws XAException
forget
in interface XAResource
xid
- A global transaction identifier.XAException
- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public abstract void rollback(Xid xid) throws XAException
rollback
in interface XAResource
xid
- A global transaction identifier.XAException
- An error has occurred.public Xid[] recover(int flag) throws XAException
MyXid[] xids = xaRes.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN); for (int i=0; xids != null && i < xids.length; i++) { try { xaRes.rollback(xids[i]); ...
MyXid[] xids = xaRes.recover(XAResource.TMSTARTRSCAN); while( xids!=null && xids.length>0) { for (int i=0; i < xids.length; i++) { try { xaRes.rollback(xids[i]); ... xids = xaRes.recover(XAResource.TMNOFLAG); } xaRes.recover(XAResource.TMENDRSCAN);
MyXid[] xids = xaRes.recover(XAResource.TMNOFLAG); for (int i=0; xids != null && i < xids.length; i++) { try { xaRes.rollback(xids[i]); ...
recover
in interface XAResource
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in flags.XAException
- An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.protected void restoreAutoCommitModeForGlobalTransaction() throws XAException
XAException
protected void saveAndAlterAutoCommitModeForGlobalTransaction() throws XAException
SQLException
XAException
public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
- - An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL.public boolean isSameRM(XAResource xares) throws XAException
isSameRM
in interface XAResource
xares
- - An XAResource object whose resource manager instance is to be compared with the resource manager instance of the target object.XAException
- - An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL.public boolean setTransactionTimeout(int seconds) throws XAException
setTransactionTimeout
in interface XAResource
seconds
- - transaction timeout value in seconds.XAException
- - An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.protected void allowGlobalTxnModeOnly(int errorCode) throws XAException
XAException
protected void exitGlobalTxnMode()
protected void enterGlobalTxnMode()
protected void checkError(int error) throws XAException
XAException
protected void checkError(int error, SQLException sqlException) throws XAException
XAException
protected void checkError(int error, int defaultXAError) throws XAException
XAException
protected void checkError(SQLException sqlex, int defaultXAError) throws XAException
XAException
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
protected void debug(Logger logger, Level level, Executable method, String msg)