public abstract class OracleXAResource extends java.lang.Object implements javax.transaction.xa.XAResource, oracle.jdbc.internal.Monitor, Diagnosable
| Modifier and Type | Field and Description |
|---|---|
protected javax.transaction.xa.Xid |
activeXid |
protected boolean |
canBeMigratablySuspended |
protected java.sql.Connection |
connection |
protected java.lang.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 java.util.Hashtable<javax.transaction.xa.Xid,oracle.jdbc.xa.OracleXAResource.XidListEntry> |
xidHash |
| Constructor and Description |
|---|
OracleXAResource() |
OracleXAResource(java.sql.Connection pm_conn,
OracleXAConnection xaconn)
OracleXAResource() -- The initializer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
allowGlobalTxnModeOnly(int errorCode) |
protected void |
checkError(int error) |
protected void |
checkError(int error,
int defaultXAError) |
protected void |
checkError(int error,
java.sql.SQLException sqlException) |
abstract void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
commit() -- Commit work done by global transaction specified by xid.
|
protected javax.transaction.xa.XAException |
convertError(java.sql.SQLException sqlex,
int defaultXAError)
Convert a SQLException into an XAException.
|
protected void |
createOrUpdateXid(javax.transaction.xa.Xid xid,
boolean isSuspended,
boolean[] isLocallySuspended)
createOrUpdateXid () - Pushes the current xid.
|
abstract void |
end(javax.transaction.xa.Xid xid,
int flag)
end()-- End work performed on behalf of a transaction branch.
|
protected void |
enterGlobalTxnMode() |
protected void |
exitGlobalTxnMode() |
abstract void |
forget(javax.transaction.xa.Xid xid)
forget() -- Tell RM to forget about a heuristically completed txn branch
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling() |
Diagnosable |
getDiagnosable() |
oracle.jdbc.internal.Monitor.CloseableLock |
getMonitorLock() |
protected oracle.jdbc.internal.OracleConnection |
getPhysicalConnection()
Returns the physical connection that this OracleXAResource object should
use.
|
int |
getTransactionTimeout()
Obtain the current transaction timeout value set for this XAResource
instance.
|
protected boolean |
isOnStack(javax.transaction.xa.Xid xid) |
boolean |
isSameRM(javax.transaction.xa.XAResource xares)
This method is called to determine if the resource manager instance
represented by the target object is the same as the resource manager
instance represented by the parameter xares.
|
protected boolean |
isXidListEmpty() |
protected boolean |
isXidSuspended(javax.transaction.xa.Xid xid)
isXidSuspended(Xid) - Checks if the passed Xid is suspended or not.
|
abstract int |
prepare(javax.transaction.xa.Xid xid)
prepare() -- Ask RM to prepare for a commit of the txn specified in xid.
|
javax.transaction.xa.Xid[] |
recover(int flag)
Obtain a list of prepared transaction branches from a resource
manager.
|
protected boolean |
removeXidFromList(javax.transaction.xa.Xid xid) |
protected void |
restoreAutoCommitModeForGlobalTransaction()
Restore the auto-commit status of the Connection & the PooledConnection.
|
protected void |
restoreAutoCommitModeForSessionlessTransaction()
Restore the auto-commit status of the Connection and the PooledConnection
Typically, invoked after ending a sessionless transaction.
|
protected void |
resumeStacked(javax.transaction.xa.Xid xid)
resumeStacked() - Resumes the current transaction after the possible
suspension of the stacked transaction, if any.
|
abstract void |
rollback(javax.transaction.xa.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.
|
protected void |
saveAndAlterAutoCommitModeForSessionlessTransaction()
Save the auto-commit status of the Connection and the PooledConnection
Typically, invoked before starting a sessionless transaction.
|
boolean |
setTransactionTimeout(int seconds)
Set the current transaction timeout value for this XAResource instance.
|
abstract void |
start(javax.transaction.xa.Xid xid,
int flag)
start() -- Starts work on behalf of a transaction branch.
|
protected javax.transaction.xa.Xid |
suspendStacked(javax.transaction.xa.Xid xid)
suspendStacked() - Suspends the stacked transaction, if any.
|
protected boolean |
updateXidList(javax.transaction.xa.Xid xid,
boolean[] flags)
updateXidList() - Update the Xid status in the list
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitacquireCloseableLock, acquireLock, assertLockHeldByCurrentThread, isReentrantLock, newDefaultLock, newInstance, releaseLockbegin, beginCurrentSql, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debugp, end, endCurrentSql, format, isDebugEnabled, isDiagnoseFirstFailureEnabled, isLoggable, isSensitiveEnabled, onClose, propertyChange, resumeLogging, secure, suspendLogging, trace, traceppublic 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 java.sql.Connection connection
protected OracleXAConnection xaconnection
protected int timeout
protected java.lang.String dblink
protected boolean canBeMigratablySuspended
protected javax.transaction.xa.Xid activeXid
protected java.util.Hashtable<javax.transaction.xa.Xid,oracle.jdbc.xa.OracleXAResource.XidListEntry> xidHash
public OracleXAResource()
public OracleXAResource(java.sql.Connection pm_conn,
OracleXAConnection xaconn)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAException - throws an exception if the connection object
is null.protected final oracle.jdbc.internal.OracleConnection getPhysicalConnection()
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected final boolean removeXidFromList(javax.transaction.xa.Xid xid)
protected final boolean isOnStack(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected final boolean isXidListEmpty()
protected void createOrUpdateXid(javax.transaction.xa.Xid xid,
boolean isSuspended,
boolean[] isLocallySuspended)
xid - Xid to save.protected boolean updateXidList(javax.transaction.xa.Xid xid,
boolean[] flags)
protected boolean isXidSuspended(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAException - if the suspend operation fails.protected javax.transaction.xa.Xid suspendStacked(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.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.javax.transaction.xa.XAException - if the suspend operation fails.protected void resumeStacked(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
xid - Xid of stacked transaction. If null, then this is a no-op.javax.transaction.xa.XAException - if the resume operation fails.public abstract void start(javax.transaction.xa.Xid xid,
int flag)
throws javax.transaction.xa.XAException
start in interface javax.transaction.xa.XAResourcexid - A global transaction identifier.javax.transaction.xa.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(javax.transaction.xa.Xid xid,
int flag)
throws javax.transaction.xa.XAException
end in interface javax.transaction.xa.XAResourcexid - A global transaction identifier that is the same
as what was used previously in the start method.flag - One of TMSUCCESS, TMFAIL, or TMSUSPEND.javax.transaction.xa.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(javax.transaction.xa.Xid xid,
boolean onePhase)
throws javax.transaction.xa.XAException
commit in interface javax.transaction.xa.XAResourcexid - 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.javax.transaction.xa.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 parameter
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(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
prepare in interface javax.transaction.xa.XAResourcexid - A global transaction identifier.javax.transaction.xa.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(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
forget in interface javax.transaction.xa.XAResourcexid - A global transaction identifier.javax.transaction.xa.XAException - An error has occurred. Possible exception values are XAER_RMERR,
XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public abstract void rollback(javax.transaction.xa.Xid xid)
throws javax.transaction.xa.XAException
rollback in interface javax.transaction.xa.XAResourcexid - A global transaction identifier.javax.transaction.xa.XAException - An error has occurred.public javax.transaction.xa.Xid[] recover(int flag)
throws javax.transaction.xa.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 javax.transaction.xa.XAResourceflag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS
must be used when no other flags are set in flags.javax.transaction.xa.XAException - An error has occurred. Possible values are
XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.protected void restoreAutoCommitModeForSessionlessTransaction()
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void restoreAutoCommitModeForGlobalTransaction()
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void saveAndAlterAutoCommitModeForSessionlessTransaction()
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void saveAndAlterAutoCommitModeForGlobalTransaction()
throws javax.transaction.xa.XAException
java.sql.SQLExceptionjavax.transaction.xa.XAExceptionpublic int getTransactionTimeout()
throws javax.transaction.xa.XAException
getTransactionTimeout in interface javax.transaction.xa.XAResourcejavax.transaction.xa.XAException - - An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL.public boolean isSameRM(javax.transaction.xa.XAResource xares)
throws javax.transaction.xa.XAException
isSameRM in interface javax.transaction.xa.XAResourcexares - - An XAResource object whose resource manager instance
is to be compared with the resource manager instance
of the target object.javax.transaction.xa.XAException - - An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL.public boolean setTransactionTimeout(int seconds)
throws javax.transaction.xa.XAException
setTransactionTimeout in interface javax.transaction.xa.XAResourceseconds - - transaction timeout value in seconds.javax.transaction.xa.XAException - - An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.protected void allowGlobalTxnModeOnly(int errorCode)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void exitGlobalTxnMode()
protected void enterGlobalTxnMode()
protected void checkError(int error)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void checkError(int error,
java.sql.SQLException sqlException)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected void checkError(int error,
int defaultXAError)
throws javax.transaction.xa.XAException
javax.transaction.xa.XAExceptionprotected javax.transaction.xa.XAException convertError(java.sql.SQLException sqlex,
int defaultXAError)
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
public final oracle.jdbc.internal.Monitor.CloseableLock getMonitorLock()
getMonitorLock in interface oracle.jdbc.internal.Monitorpublic Diagnosable getDiagnosable()
getDiagnosable in interface Diagnosable