Package oracle.jdbc.xa.client
Class OracleXAResource
- java.lang.Object
-
- oracle.jdbc.xa.OracleXAResource
-
- oracle.jdbc.xa.client.OracleXAResource
-
- All Implemented Interfaces:
javax.transaction.xa.XAResource,oracle.jdbc.diagnostics.Diagnosable,oracle.jdbc.diagnostics.PropertyChangeListener,oracle.jdbc.internal.Monitor
- Direct Known Subclasses:
OracleXAHeteroResource
public class OracleXAResource extends OracleXAResource
Implements javax.transaction.xa.XAResource.
-
-
Field Summary
-
Fields inherited from class oracle.jdbc.xa.OracleXAResource
activeXid, canBeMigratablySuspended, connection, dblink, DEFAULT_XA_TIMEOUT, ORAISOLATIONMASK, ORATMREADONLY, ORATMREADWRITE, ORATMSERIALIZABLE, ORATRANSLOOSE, savedConnectionAutoCommit, savedXAConnectionAutoCommit, timeout, TMENDRSCAN, TMFAIL, TMJOIN, TMMIGRATE, TMNOFLAGS, TMNOMIGRATE, TMONEPHASE, TMPROMOTE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, xaconnection, xidHash
-
-
Constructor Summary
Constructors Constructor Description OracleXAResource()OracleXAResource(java.sql.Connection pm_conn, OracleXAConnection xaconn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit(javax.transaction.xa.Xid xid, boolean onePhase)commit() -- Commit work done by global transaction specified by xid.protected voidcommitSessionlessTransaction(javax.transaction.xa.Xid xid)Commit sessionless transaction when XAThroughSessionlessTransactions is enabled.protected voiddoCommit(javax.transaction.xa.Xid xid, boolean onePhase)protected intdoDoTwoPhaseAction(int nsites, int action, java.lang.String[] dbnames, javax.transaction.xa.Xid[] xids)protected intdoEnd(javax.transaction.xa.Xid xid, int flag, boolean isLocallySuspended)protected intdoForget(javax.transaction.xa.Xid xid)protected intdoPrepare(javax.transaction.xa.Xid xid)protected voiddoRollback(javax.transaction.xa.Xid xid)protected intdoStart(javax.transaction.xa.Xid xid, int flag)voiddoTwoPhaseAction(int nsites, int action, java.lang.String[] dbnames, javax.transaction.xa.Xid[] xids)voidend(javax.transaction.xa.Xid xid, int flag)end()-- End work performed on behalf of a transaction branch.protected voidendSessionlessTransaction(javax.transaction.xa.Xid xid, int flag)Suspend sessionless transaction when XAThroughSessionlessTransactions is enabled.voidforget(javax.transaction.xa.Xid xid)forget() -- Tell RM to forget about a heuristically completed txn branchintprepare(javax.transaction.xa.Xid xid)prepare() -- Ask RM to prepare for a commit of the txn specified in xid.voidrollback(javax.transaction.xa.Xid xid)rollback() -- Ask RM to roll back work done on behalf of a txn branch.protected voidrollbackSessionlessTransaction(javax.transaction.xa.Xid xid)Rollback sessionless transaction when XAThroughSessionlessTransactions is enabled.voidstart(javax.transaction.xa.Xid xid, int flag)start() -- Starts work on behalf of a transaction branch.protected voidstartSessionlessTransaction(javax.transaction.xa.Xid xid, int flag)Start/Resume sessionless transaction when XAThroughSessionlessTransactions is enabled.-
Methods inherited from class oracle.jdbc.xa.OracleXAResource
allowGlobalTxnModeOnly, checkError, checkError, checkError, convertError, createOrUpdateXid, enterGlobalTxnMode, exitGlobalTxnMode, getConnectionDuringExceptionHandling, getDiagnosable, getMonitorLock, getPhysicalConnection, getTransactionTimeout, isOnStack, isSameRM, isXidListEmpty, isXidSuspended, recover, removeXidFromList, restoreAutoCommitModeForGlobalTransaction, restoreAutoCommitModeForSessionlessTransaction, resumeStacked, saveAndAlterAutoCommitModeForGlobalTransaction, saveAndAlterAutoCommitModeForSessionlessTransaction, setTransactionTimeout, suspendStacked, updateXidList
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface oracle.jdbc.diagnostics.Diagnosable
begin, 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, tracep
-
-
-
-
Constructor Detail
-
OracleXAResource
public OracleXAResource()
-
OracleXAResource
public OracleXAResource(java.sql.Connection pm_conn, OracleXAConnection xaconn) throws javax.transaction.xa.XAException- Throws:
javax.transaction.xa.XAException
-
-
Method Detail
-
startSessionlessTransaction
protected void startSessionlessTransaction(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAExceptionStart/Resume sessionless transaction when XAThroughSessionlessTransactions is enabled.- Parameters:
xid- the transaction idflag- TMNOFLAGS, TMRESUME- Throws:
javax.transaction.xa.XAException
-
endSessionlessTransaction
protected void endSessionlessTransaction(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAExceptionSuspend sessionless transaction when XAThroughSessionlessTransactions is enabled.- Parameters:
xid- the transaction idflag- TMSUSPEND- Throws:
javax.transaction.xa.XAException
-
commitSessionlessTransaction
protected void commitSessionlessTransaction(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAExceptionCommit sessionless transaction when XAThroughSessionlessTransactions is enabled.- Parameters:
xid- the transaction id- Throws:
javax.transaction.xa.XAException
-
rollbackSessionlessTransaction
protected void rollbackSessionlessTransaction(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAExceptionRollback sessionless transaction when XAThroughSessionlessTransactions is enabled.- Parameters:
xid- the transaction id- Throws:
javax.transaction.xa.XAException
-
start
public void start(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAExceptionstart() -- Starts work on behalf of a transaction branch. If TMJOIN is specified, the start is for joining an existing txn branch xid. If TMRESUME is specified, the start is to resume a suspended transaction branch specified in xid. Transaction suspend is done by calling the end method specifying the TMSUSPEND flag. If neither TMJOIN nor TMRESUME is specified and the transaction branch specified in xid already exists, the resource manager raises the duplicate transaction exception via XAER_DUPID. start() allows Isolation flags to be set, only when beginning a new transaction. XAER_INVAL exception is raised for error cases, such as (1) when JOIN/RESUME specified on start (2) invalid Isol flag is set. The valid Isolation levels allowed are: ORATMREADONLY ORATMREADWRITE ORATMSERIALIZABLE- Specified by:
startin interfacejavax.transaction.xa.XAResource- Specified by:
startin classOracleXAResource- Parameters:
xid- A global transaction identifier.flag- One of TMNOFLAGS, TMJOIN, TMNOMIGRATE or TMRESUME.- Throws:
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.
-
doStart
protected int doStart(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
end
public void end(javax.transaction.xa.Xid xid, int flag) throws javax.transaction.xa.XAExceptionend()-- End work performed on behalf of a transaction branch. The resource manager dissociates the XA resource from the transaction branch specified and let the transaction be completed. If TMSUSPEND is specified in flag, the txn branch is temporarily suspended in incomplete state. The txn context is in suspended state and must be resumed via start with TMRESUME specified. If TMFAIL is specified, the portion of work has failed. The RM may mark the transaction as rollback-only. If TMSUCCESS is specified, the portion of work has completed successfully.- Specified by:
endin interfacejavax.transaction.xa.XAResource- Specified by:
endin classOracleXAResource- Parameters:
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.- Throws:
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.
-
doEnd
protected int doEnd(javax.transaction.xa.Xid xid, int flag, boolean isLocallySuspended) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
commit
public void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAExceptioncommit() -- Commit work done by global transaction specified by xid.- Specified by:
commitin interfacejavax.transaction.xa.XAResource- Specified by:
commitin classOracleXAResource- Parameters:
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.- Throws:
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.
-
doCommit
protected void doCommit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
prepare
public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAExceptionprepare() -- Ask RM to prepare for a commit of the txn specified in xid.- Specified by:
preparein interfacejavax.transaction.xa.XAResource- Specified by:
preparein classOracleXAResource- Parameters:
xid- A global transaction identifier.- Returns:
- A value indicating the resource manager's vote on the outcome of the txn. The possible values are: XA_RDONLY or XA_OK. If the RM wants to roll back the transaction, it should do so by raising an appropriate XAException in the prepare method.
- Throws:
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.
-
doPrepare
protected int doPrepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
forget
public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAExceptionforget() -- Tell RM to forget about a heuristically completed txn branch- Specified by:
forgetin interfacejavax.transaction.xa.XAResource- Specified by:
forgetin classOracleXAResource- Parameters:
xid- A global transaction identifier.- Throws:
javax.transaction.xa.XAException- An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
-
doForget
protected int doForget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
rollback
public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAExceptionrollback() -- Ask RM to roll back work done on behalf of a txn branch.- Specified by:
rollbackin interfacejavax.transaction.xa.XAResource- Specified by:
rollbackin classOracleXAResource- Parameters:
xid- A global transaction identifier.- Throws:
javax.transaction.xa.XAException- An error has occurred.
-
doRollback
protected void doRollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException, java.sql.SQLException- Throws:
javax.transaction.xa.XAExceptionjava.sql.SQLException
-
doTwoPhaseAction
public void doTwoPhaseAction(int nsites, int action, java.lang.String[] dbnames, javax.transaction.xa.Xid[] xids) throws javax.transaction.xa.XAException- Throws:
javax.transaction.xa.XAException
-
doDoTwoPhaseAction
protected int doDoTwoPhaseAction(int nsites, int action, java.lang.String[] dbnames, javax.transaction.xa.Xid[] xids) throws javax.transaction.xa.XAException- Throws:
javax.transaction.xa.XAException
-
-