Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.client.net
Class NetXAResource  view NetXAResource download NetXAResource.java

java.lang.Object
  extended byorg.apache.derby.client.net.NetXAResource
All Implemented Interfaces:
javax.transaction.xa.XAResource

public class NetXAResource
extends java.lang.Object
implements javax.transaction.xa.XAResource


Field Summary
static int ACTIVE_ONLY
           
(package private)  int activeXATransCount_
           
(package private)  NetXACallInfo[] callInfoArray_
           
(package private)  NetXAConnection conn_
           
(package private)  int connectionCount_
           
 org.apache.derby.client.am.SqlException exceptionsOnXA
           
protected  boolean ignoreMe_
           
static int INITIAL_CALLINFO_ELEMENTS
           
(package private)  java.lang.String ipaddr_
           
 int nextElement
           
protected  NetXAResource nextSameRM_
           
static org.apache.derby.client.ClientXid nullXid
           
(package private)  int numXACallInfo_
           
(package private)  int port_
           
static int RECOVER_XID_ARRAY_LENGTH
           
(package private)  int rmId_
           
(package private)  java.lang.String rmIdx_
           
(package private)  java.lang.String rmIdy_
           
protected  int sameRMGroupIndex_
           
private  java.util.List specialRegisters_
           
static int TMTIMEOUT
           
static int XA_NULL_XID
           
(package private)  javax.sql.XAConnection xaconn_
           
static int XAFUNC_COMMIT
           
static int XAFUNC_END
           
static int XAFUNC_FORGET
           
static int XAFUNC_NONE
           
static int XAFUNC_PREPARE
           
static int XAFUNC_RECOVER
           
static int XAFUNC_ROLLBACK
           
static int XAFUNC_START
           
static java.lang.String XAFUNCSTR_COMMIT
           
static java.lang.String XAFUNCSTR_END
           
static java.lang.String XAFUNCSTR_FORGET
           
static java.lang.String XAFUNCSTR_NONE
           
static java.lang.String XAFUNCSTR_PREPARE
           
static java.lang.String XAFUNCSTR_RECOVER
           
static java.lang.String XAFUNCSTR_ROLLBACK
           
static java.lang.String XAFUNCSTR_START
           
protected static java.util.Vector xaResourceSameRMGroup_
           
static int XARETVAL_NODISSOCIATE
           
static int XARETVAL_RBCOMMFAIL
           
static int XARETVAL_RBDEADLOCK
           
static int XARETVAL_RBINTEGRITY
           
static int XARETVAL_RBOTHER
           
static int XARETVAL_RBPROTO
           
static int XARETVAL_RBROLLBACK
           
static int XARETVAL_RBTIMEOUT
           
static int XARETVAL_RBTRANSIENT
           
static int XARETVAL_XACOMMFAIL
           
static int XARETVAL_XADEFERRED
           
static int XARETVAL_XAERASYNC
           
static int XARETVAL_XAERDUPID
           
static int XARETVAL_XAERINVAL
           
static int XARETVAL_XAERNOTA
           
static int XARETVAL_XAEROPENRES
           
static int XARETVAL_XAEROUTSIDE
           
static int XARETVAL_XAERPROTO
           
static int XARETVAL_XAERRMERR
           
static int XARETVAL_XAERRMFAIL
           
static int XARETVAL_XAHEURCOM
           
static int XARETVAL_XAHEURHAZ
           
static int XARETVAL_XAHEURMIX
           
static int XARETVAL_XAHEURRB
           
static int XARETVAL_XALCSNOTSUPP
           
static int XARETVAL_XANOMIGRATE
           
static int XARETVAL_XAOK
           
static int XARETVAL_XAPROMOTED
           
static int XARETVAL_XARDONLY
           
static int XARETVAL_XARETRY
           
static int XARETVAL_XATWOPHASE
           
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
NetXAResource(javax.sql.XAConnection xaconn, int rmId, java.lang.String userId, java.lang.String password, NetXAConnection conn)
           
 
Method Summary
 void addSpecialRegisters(java.lang.String s)
           
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
           
private  void connectionClosedFailure()
           
 void end(javax.transaction.xa.Xid xid, int flags)
          Ends the work performed on behalf of a transaction branch.
 void forget(javax.transaction.xa.Xid xid)
          Tell the resource manager to forget about a heuristically (MANUALLY) completed transaction branch.
 java.util.List getSpecialRegisters()
           
 int getTransactionTimeout()
          Obtain the current transaction timeout value set for this XAResource instance.
private  java.lang.String getXAExceptionText(int rc)
           
private  java.lang.String getXAFuncStr(int xaFunc)
           
 void initForReuse()
           
 boolean isSameRM(javax.transaction.xa.XAResource xares)
           
 int prepare(javax.transaction.xa.Xid xid)
          Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
private  java.lang.String processLocalHost(java.lang.String serverName)
           
 javax.transaction.xa.Xid[] recover(int flag)
          Obtain a list of prepared transaction branches from a resource manager.
protected  void removeXaresFromSameRMchain()
           
 void rollback(javax.transaction.xa.Xid xid)
          Inform the resource manager to roll back work done on behalf of a transaction branch
 boolean setTransactionTimeout(int seconds)
          Set the current transaction timeout value for this XAResource instance.
private  void setXaStateForXAException(int rc)
          Reset the transaction branch association state to XA_T0_NOT_ASSOCIATED for XAER_RM* and XA_RB* Exceptions.
 void start(javax.transaction.xa.Xid xid, int flags)
          Start work on behalf of a transaction branch specified in xid
protected  void throwXAException(int rc)
           
protected  void throwXAException(int rc, boolean resetFlag)
           
protected  int xaRetValErrorAccumSQL(NetXACallInfo callInfo, int currentRC)
           
static boolean xidsEqual(javax.transaction.xa.Xid xid1, javax.transaction.xa.Xid xid2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMTIMEOUT

public static final int TMTIMEOUT
See Also:
Constant Field Values

ACTIVE_ONLY

public static final int ACTIVE_ONLY
See Also:
Constant Field Values

XA_NULL_XID

public static final int XA_NULL_XID
See Also:
Constant Field Values

INITIAL_CALLINFO_ELEMENTS

public static final int INITIAL_CALLINFO_ELEMENTS
See Also:
Constant Field Values

RECOVER_XID_ARRAY_LENGTH

public static final int RECOVER_XID_ARRAY_LENGTH
See Also:
Constant Field Values

nullXid

public static final org.apache.derby.client.ClientXid nullXid

XARETVAL_XALCSNOTSUPP

public static final int XARETVAL_XALCSNOTSUPP
See Also:
Constant Field Values

XARETVAL_RBROLLBACK

public static final int XARETVAL_RBROLLBACK
See Also:
Constant Field Values

XARETVAL_RBCOMMFAIL

public static final int XARETVAL_RBCOMMFAIL
See Also:
Constant Field Values

XARETVAL_RBDEADLOCK

public static final int XARETVAL_RBDEADLOCK
See Also:
Constant Field Values

XARETVAL_RBINTEGRITY

public static final int XARETVAL_RBINTEGRITY
See Also:
Constant Field Values

XARETVAL_RBOTHER

public static final int XARETVAL_RBOTHER
See Also:
Constant Field Values

XARETVAL_RBPROTO

public static final int XARETVAL_RBPROTO
See Also:
Constant Field Values

XARETVAL_RBTIMEOUT

public static final int XARETVAL_RBTIMEOUT
See Also:
Constant Field Values

XARETVAL_RBTRANSIENT

public static final int XARETVAL_RBTRANSIENT
See Also:
Constant Field Values

XARETVAL_NODISSOCIATE

public static final int XARETVAL_NODISSOCIATE
See Also:
Constant Field Values

XARETVAL_XATWOPHASE

public static final int XARETVAL_XATWOPHASE
See Also:
Constant Field Values

XARETVAL_XAPROMOTED

public static final int XARETVAL_XAPROMOTED
See Also:
Constant Field Values

XARETVAL_XADEFERRED

public static final int XARETVAL_XADEFERRED
See Also:
Constant Field Values

XARETVAL_XACOMMFAIL

public static final int XARETVAL_XACOMMFAIL
See Also:
Constant Field Values

XARETVAL_XANOMIGRATE

public static final int XARETVAL_XANOMIGRATE
See Also:
Constant Field Values

XARETVAL_XAHEURHAZ

public static final int XARETVAL_XAHEURHAZ
See Also:
Constant Field Values

XARETVAL_XAHEURCOM

public static final int XARETVAL_XAHEURCOM
See Also:
Constant Field Values

XARETVAL_XAHEURRB

public static final int XARETVAL_XAHEURRB
See Also:
Constant Field Values

XARETVAL_XAHEURMIX

public static final int XARETVAL_XAHEURMIX
See Also:
Constant Field Values

XARETVAL_XARETRY

public static final int XARETVAL_XARETRY
See Also:
Constant Field Values

XARETVAL_XARDONLY

public static final int XARETVAL_XARDONLY
See Also:
Constant Field Values

XARETVAL_XAOK

public static final int XARETVAL_XAOK
See Also:
Constant Field Values

XARETVAL_XAERASYNC

public static final int XARETVAL_XAERASYNC
See Also:
Constant Field Values

XARETVAL_XAERRMERR

public static final int XARETVAL_XAERRMERR
See Also:
Constant Field Values

XARETVAL_XAERNOTA

public static final int XARETVAL_XAERNOTA
See Also:
Constant Field Values

XARETVAL_XAERINVAL

public static final int XARETVAL_XAERINVAL
See Also:
Constant Field Values

XARETVAL_XAERPROTO

public static final int XARETVAL_XAERPROTO
See Also:
Constant Field Values

XARETVAL_XAERRMFAIL

public static final int XARETVAL_XAERRMFAIL
See Also:
Constant Field Values

XARETVAL_XAERDUPID

public static final int XARETVAL_XAERDUPID
See Also:
Constant Field Values

XARETVAL_XAEROUTSIDE

public static final int XARETVAL_XAEROUTSIDE
See Also:
Constant Field Values

XARETVAL_XAEROPENRES

public static final int XARETVAL_XAEROPENRES
See Also:
Constant Field Values

XAFUNC_NONE

public static final int XAFUNC_NONE
See Also:
Constant Field Values

XAFUNC_COMMIT

public static final int XAFUNC_COMMIT
See Also:
Constant Field Values

XAFUNC_END

public static final int XAFUNC_END
See Also:
Constant Field Values

XAFUNC_FORGET

public static final int XAFUNC_FORGET
See Also:
Constant Field Values

XAFUNC_PREPARE

public static final int XAFUNC_PREPARE
See Also:
Constant Field Values

XAFUNC_RECOVER

public static final int XAFUNC_RECOVER
See Also:
Constant Field Values

XAFUNC_ROLLBACK

public static final int XAFUNC_ROLLBACK
See Also:
Constant Field Values

XAFUNC_START

public static final int XAFUNC_START
See Also:
Constant Field Values

XAFUNCSTR_NONE

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

XAFUNCSTR_COMMIT

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

XAFUNCSTR_END

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

XAFUNCSTR_FORGET

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

XAFUNCSTR_PREPARE

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

XAFUNCSTR_RECOVER

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

XAFUNCSTR_ROLLBACK

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

XAFUNCSTR_START

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

nextElement

public int nextElement

xaResourceSameRMGroup_

protected static java.util.Vector xaResourceSameRMGroup_

sameRMGroupIndex_

protected int sameRMGroupIndex_

nextSameRM_

protected NetXAResource nextSameRM_

ignoreMe_

protected boolean ignoreMe_

exceptionsOnXA

public org.apache.derby.client.am.SqlException exceptionsOnXA

xaconn_

javax.sql.XAConnection xaconn_

conn_

NetXAConnection conn_

rmId_

int rmId_

callInfoArray_

NetXACallInfo[] callInfoArray_

numXACallInfo_

int numXACallInfo_

connectionCount_

int connectionCount_

activeXATransCount_

int activeXATransCount_

rmIdx_

java.lang.String rmIdx_

rmIdy_

java.lang.String rmIdy_

port_

int port_

ipaddr_

java.lang.String ipaddr_

specialRegisters_

private java.util.List specialRegisters_
Constructor Detail

NetXAResource

public NetXAResource(javax.sql.XAConnection xaconn,
                     int rmId,
                     java.lang.String userId,
                     java.lang.String password,
                     NetXAConnection conn)
Method Detail

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Specified by:
commit in interface javax.transaction.xa.XAResource

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Ends the 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 flags, the transaction branch is temporarily suspended in incomplete state. The transaction 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 resource manager 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

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Tell the resource manager to forget about a heuristically (MANUALLY) completed transaction branch.

Specified by:
forget in interface javax.transaction.xa.XAResource

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Obtain the current transaction timeout value set for this XAResource instance. If XAResource.setTransactionTimeout was not use prior to invoking this method, the return value is the default timeout set for the resource manager; otherwise, the value used in the previous setTransactionTimeout call is returned.

Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource

prepare

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

Specified by:
prepare in interface javax.transaction.xa.XAResource

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Obtain a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.

Specified by:
recover in interface javax.transaction.xa.XAResource

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Inform the resource manager to roll back work done on behalf of a transaction branch

Specified by:
rollback in interface javax.transaction.xa.XAResource

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws javax.transaction.xa.XAException

Set the current transaction timeout value for this XAResource instance. This value overwrites the default transaction timeout value in the resource manager. The newly assigned timeout value is effective for the life of this XAResource instance unless a new value is set.

Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource

start

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

Specified by:
start in interface javax.transaction.xa.XAResource

throwXAException

protected void throwXAException(int rc)
                         throws javax.transaction.xa.XAException

getXAExceptionText

private java.lang.String getXAExceptionText(int rc)

throwXAException

protected void throwXAException(int rc,
                                boolean resetFlag)
                         throws javax.transaction.xa.XAException

setXaStateForXAException

private void setXaStateForXAException(int rc)
Reset the transaction branch association state to XA_T0_NOT_ASSOCIATED for XAER_RM* and XA_RB* Exceptions. All other exeptions leave the state unchanged


isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource

xidsEqual

public static boolean xidsEqual(javax.transaction.xa.Xid xid1,
                                javax.transaction.xa.Xid xid2)

getSpecialRegisters

public java.util.List getSpecialRegisters()

addSpecialRegisters

public void addSpecialRegisters(java.lang.String s)

connectionClosedFailure

private void connectionClosedFailure()
                              throws javax.transaction.xa.XAException

getXAFuncStr

private java.lang.String getXAFuncStr(int xaFunc)

xaRetValErrorAccumSQL

protected int xaRetValErrorAccumSQL(NetXACallInfo callInfo,
                                    int currentRC)

processLocalHost

private java.lang.String processLocalHost(java.lang.String serverName)

removeXaresFromSameRMchain

protected void removeXaresFromSameRMchain()

initForReuse

public void initForReuse()