com.atomikos.datasource.xa
Class XAResourceTransaction

java.lang.Object
  extended by com.atomikos.datasource.xa.XAResourceTransaction
All Implemented Interfaces:
ResourceTransaction, Participant, Externalizable, Serializable

public class XAResourceTransaction
extends Object
implements ResourceTransaction, Externalizable, Participant

An implementation of ResourceTransaction for XA transactions.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.atomikos.icatch.Participant
READ_ONLY
 
Constructor Summary
XAResourceTransaction()
           
 
Method Summary
 void addCompensationContext(Dictionary context)
           
 void addHeuristicMessage(HeuristicMessage mesg)
           
 HeuristicMessage[] commit(boolean onePhase)
           
 boolean equals(Object o)
          Absolutely necessary for coordinator to work correctly
protected  void forceRefreshXAConnection()
           
 void forget()
           
 Dictionary getCompensationContext()
           
 HeuristicMessage[] getHeuristicMessages()
           
 Object getState()
           
 String getTid()
           
 String getURI()
           
 Xid getXid()
          Get the Xid.
 int hashCode()
          Absolutely necessary for coordinator to work correctly
protected static String interpretErrorCode(String resourceName, String opCode, Xid xid, int errorCode)
           
 boolean isActive()
          Test if the restx is active (in use).
 boolean isXaSuspended()
          Test if the resource has been ended with TMSUSPEND.
 int prepare()
           
 void readExternal(ObjectInput in)
           
 boolean recover()
           
 void resume()
           
 HeuristicMessage[] rollback()
           
 void setCascadeList(Dictionary allParticipants)
           
 void setGlobalSiblingCount(int count)
           
protected  void setRecoveredXAResource(XAResource xaresource)
           
 void setXAResource(XAResource xaresource)
          Set the XAResource attribute.
 void suspend()
           
protected  void testOrRefreshXAResourceFor2PC()
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 void xaResume()
          Perform an xa resume
 void xaSuspend()
          Perform an XA suspend.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XAResourceTransaction

public XAResourceTransaction()
Method Detail

interpretErrorCode

protected static String interpretErrorCode(String resourceName,
                                           String opCode,
                                           Xid xid,
                                           int errorCode)

testOrRefreshXAResourceFor2PC

protected void testOrRefreshXAResourceFor2PC()
                                      throws XAException
Throws:
XAException

forceRefreshXAConnection

protected void forceRefreshXAConnection()
                                 throws XAException
Throws:
XAException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

getTid

public String getTid()
Specified by:
getTid in interface ResourceTransaction
See Also:
ResourceTransaction.

addCompensationContext

public void addCompensationContext(Dictionary context)
                            throws IllegalStateException
Throws:
IllegalStateException
See Also:
ResourceTransaction.

addHeuristicMessage

public void addHeuristicMessage(HeuristicMessage mesg)
                         throws IllegalStateException
Specified by:
addHeuristicMessage in interface ResourceTransaction
Throws:
IllegalStateException
See Also:
ResourceTransaction.

getHeuristicMessages

public HeuristicMessage[] getHeuristicMessages()
Specified by:
getHeuristicMessages in interface ResourceTransaction
Specified by:
getHeuristicMessages in interface Participant
See Also:
ResourceTransaction.

getCompensationContext

public Dictionary getCompensationContext()
See Also:
ResourceTransaction.

suspend

public void suspend()
             throws ResourceException
Specified by:
suspend in interface ResourceTransaction
Throws:
ResourceException
See Also:
ResourceTransaction.

resume

public void resume()
            throws ResourceException
Specified by:
resume in interface ResourceTransaction
Throws:
ResourceException
See Also:
ResourceTransaction.

setCascadeList

public void setCascadeList(Dictionary allParticipants)
                    throws SysException
Specified by:
setCascadeList in interface Participant
Throws:
SysException
See Also:
Participant

getState

public Object getState()

recover

public boolean recover()
                throws SysException
Specified by:
recover in interface Participant
Throws:
SysException
See Also:
Participant

setGlobalSiblingCount

public void setGlobalSiblingCount(int count)
Specified by:
setGlobalSiblingCount in interface Participant
See Also:
Participant

forget

public void forget()
Specified by:
forget in interface Participant
See Also:
Participant

prepare

public int prepare()
            throws RollbackException,
                   HeurHazardException,
                   HeurMixedException,
                   SysException
Specified by:
prepare in interface Participant
Throws:
RollbackException
HeurHazardException
HeurMixedException
SysException
See Also:
Participant

rollback

public HeuristicMessage[] rollback()
                            throws HeurCommitException,
                                   HeurMixedException,
                                   HeurHazardException,
                                   SysException
Specified by:
rollback in interface Participant
Throws:
HeurCommitException
HeurMixedException
HeurHazardException
SysException
See Also:
Participant.

commit

public HeuristicMessage[] commit(boolean onePhase)
                          throws HeurRollbackException,
                                 HeurHazardException,
                                 HeurMixedException,
                                 RollbackException,
                                 SysException
Specified by:
commit in interface Participant
Throws:
HeurRollbackException
HeurHazardException
HeurMixedException
RollbackException
SysException
See Also:
Participant

equals

public boolean equals(Object o)
Absolutely necessary for coordinator to work correctly

Overrides:
equals in class Object

hashCode

public int hashCode()
Absolutely necessary for coordinator to work correctly

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getXid

public Xid getXid()
Get the Xid. Needed by jta mappings.

Returns:
Xid The Xid of this restx.

setRecoveredXAResource

protected void setRecoveredXAResource(XAResource xaresource)

setXAResource

public void setXAResource(XAResource xaresource)
Set the XAResource attribute.

Parameters:
xaresource - The new XAResource to use. This new XAResource represents the new connection to the XA database. Necessary because on reuse, the old xaresource may be in use by another thread, for another transaction.

xaSuspend

public void xaSuspend()
               throws XAException
Perform an XA suspend.

Throws:
XAException

xaResume

public void xaResume()
              throws XAException
Perform an xa resume

Throws:
XAException

isXaSuspended

public boolean isXaSuspended()
Test if the resource has been ended with TMSUSPEND.

Returns:
boolean True if so.

isActive

public boolean isActive()
Test if the restx is active (in use).

Returns:
boolean True if so.

getURI

public String getURI()
Specified by:
getURI in interface Participant
See Also:
Participant.getURI()


Copyright © 2012. All Rights Reserved.