Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

oracle.jdbc.xa.client
Class OracleXAHeteroResource

java.lang.Object
  extended by oracle.jdbc.xa.OracleXAResource
      extended by oracle.jdbc.xa.client.OracleXAResource
          extended by oracle.jdbc.xa.client.OracleXAHeteroResource
All Implemented Interfaces:
javax.transaction.xa.XAResource

public class OracleXAHeteroResource
extends OracleXAResource

Implements javax.transaction.xa.XAResource.


Field Summary
static java.lang.String BUILD_DATE
           
static boolean TRACE
           
 
Fields inherited from class oracle.jdbc.xa.OracleXAResource
DEFAULT_XA_TIMEOUT, ORAISOLATIONMASK, ORATMREADONLY, ORATMREADWRITE, ORATMSERIALIZABLE, ORATRANSLOOSE, TMENDRSCAN, TMFAIL, TMJOIN, TMMIGRATE, TMNOFLAGS, TMNOMIGRATE, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK
 
Fields inherited from interface javax.transaction.xa.XAResource
XA_RDONLY
 
Constructor Summary
OracleXAHeteroResource(java.sql.Connection pm_conn, OracleXAConnection xaconn)
           
 
Method Summary
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
          Commit work done by global transaction specified by xid.
 void end(javax.transaction.xa.Xid xid, int flag)
          End work performed on behalf of a transaction branch.
 void forget(javax.transaction.xa.Xid xid)
          Tell RM to forget about a heuristically completed txn branch
 int prepare(javax.transaction.xa.Xid xid)
          Ask RM to prepare for a commit of the txn specified in xid.
 void rollback(javax.transaction.xa.Xid xid)
          Ask RM to roll back work done on behalf of a txn branch.
 void start(javax.transaction.xa.Xid xid, int flags)
          Starts work on behalf of a transaction branch.
 
Methods inherited from class oracle.jdbc.xa.client.OracleXAResource
doTwoPhaseAction
 
Methods inherited from class oracle.jdbc.xa.OracleXAResource
getTransactionTimeout, isSameRM, recover, setTransactionTimeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILD_DATE

public static final java.lang.String BUILD_DATE
See Also:
Constant Field Values

TRACE

public static final boolean TRACE
See Also:
Constant Field Values
Constructor Detail

OracleXAHeteroResource

public OracleXAHeteroResource(java.sql.Connection pm_conn,
                              OracleXAConnection xaconn)
                       throws javax.transaction.xa.XAException
Throws:
javax.transaction.xa.XAException
Method Detail

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Starts work on behalf of a transaction branch.

If TMJOIN is specified, the start is for joining an exisiting 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:
start in interface javax.transaction.xa.XAResource
Overrides:
start in class OracleXAResource
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.

end

public void end(javax.transaction.xa.Xid xid,
                int flag)
         throws javax.transaction.xa.XAException
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 suspened 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:
end in interface javax.transaction.xa.XAResource
Overrides:
end in class OracleXAResource
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.

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Commit work done by global transaction specified by xid.

Specified by:
commit in interface javax.transaction.xa.XAResource
Overrides:
commit in class OracleXAResource
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 - 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.

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Ask RM to prepare for a commit of the txn specified in xid.

Specified by:
prepare in interface javax.transaction.xa.XAResource
Overrides:
prepare in class OracleXAResource
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 - Possible exception values are: XA_RB, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Tell RM to forget about a heuristically completed txn branch

Specified by:
forget in interface javax.transaction.xa.XAResource
Overrides:
forget in class OracleXAResource
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.

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Ask RM to roll back work done on behalf of a txn branch.

Specified by:
rollback in interface javax.transaction.xa.XAResource
Overrides:
rollback in class OracleXAResource
Parameters:
xid - A global transaction identifier.
Throws:
javax.transaction.xa.XAException - An error has occurred.

Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

Copyright © 1998, 2007, Oracle. All rights reserved.