org.mule.util.xa
Class DefaultXASession<T extends AbstractXaTransactionContext>

java.lang.Object
  extended by org.mule.util.xa.DefaultXASession<T>
Type Parameters:
T - type of the AbstractXaTransactionContext created for each transaction
All Implemented Interfaces:
XAResource
Direct Known Subclasses:
QueueXaResource

public abstract class DefaultXASession<T extends AbstractXaTransactionContext>
extends Object
implements XAResource

Base class for an XAResource implementation.


Field Summary
protected  T localContext
           
protected  Xid localXid
           
protected  org.apache.commons.logging.Log logger
           
protected  AbstractXAResourceManager<T> resourceManager
           
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
DefaultXASession(AbstractXAResourceManager resourceManager)
           
 
Method Summary
 void commit(Xid xid, boolean onePhase)
           
protected abstract  void commitDanglingTransaction(Xid xid, boolean onePhase)
          Commits a dangling transaction that can be caused by the failure of one of the XAResource involved in the transaction or a crash of the transaction manager.
protected abstract  T createTransactionContext(Xid xid)
          Creates a new transaction context with the given transaction identifier
 void end(Xid xid, int flags)
           
 void forget(Xid xid)
           
 Object getResourceManager()
           
 T getTransactionContext()
           
 int getTransactionTimeout()
           
 XAResource getXAResource()
           
 boolean isSameRM(XAResource xares)
           
 int prepare(Xid xid)
           
 void rollback(Xid xid)
           
protected abstract  void rollbackDandlingTransaction(Xid xid)
          Commits a dangling transaction that can be caused by the failure of one of the XAResource involved in the transaction or a crash of the transaction manager.
 boolean setTransactionTimeout(int timeout)
           
 void start(Xid xid, int flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.transaction.xa.XAResource
recover
 

Field Detail

logger

protected transient org.apache.commons.logging.Log logger

localXid

protected Xid localXid

resourceManager

protected AbstractXAResourceManager<T extends AbstractXaTransactionContext> resourceManager

localContext

protected T extends AbstractXaTransactionContext localContext
Constructor Detail

DefaultXASession

public DefaultXASession(AbstractXAResourceManager resourceManager)
Method Detail

getXAResource

public XAResource getXAResource()

getResourceManager

public Object getResourceManager()

isSameRM

public boolean isSameRM(XAResource xares)
                 throws XAException
Specified by:
isSameRM in interface XAResource
Throws:
XAException

start

public void start(Xid xid,
                  int flags)
           throws XAException
Specified by:
start in interface XAResource
Throws:
XAException

end

public void end(Xid xid,
                int flags)
         throws XAException
Specified by:
end in interface XAResource
Throws:
XAException

commit

public void commit(Xid xid,
                   boolean onePhase)
            throws XAException
Specified by:
commit in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException
Specified by:
rollback in interface XAResource
Throws:
XAException

prepare

public int prepare(Xid xid)
            throws XAException
Specified by:
prepare in interface XAResource
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException
Specified by:
forget in interface XAResource
Throws:
XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws XAException
Specified by:
getTransactionTimeout in interface XAResource
Throws:
XAException

setTransactionTimeout

public boolean setTransactionTimeout(int timeout)
                              throws XAException
Specified by:
setTransactionTimeout in interface XAResource
Throws:
XAException

getTransactionContext

public T getTransactionContext()

commitDanglingTransaction

protected abstract void commitDanglingTransaction(Xid xid,
                                                  boolean onePhase)
                                           throws XAException
Commits a dangling transaction that can be caused by the failure of one of the XAResource involved in the transaction or a crash of the transaction manager.

Parameters:
xid - transaction identifier
onePhase - if the commit should be done using only one phase commit
Throws:
XAException

rollbackDandlingTransaction

protected abstract void rollbackDandlingTransaction(Xid xid)
                                             throws XAException
Commits a dangling transaction that can be caused by the failure of one of the XAResource involved in the transaction or a crash of the transaction manager.

Parameters:
xid - transaction identifier
Throws:
XAException

createTransactionContext

protected abstract T createTransactionContext(Xid xid)
Creates a new transaction context with the given transaction identifier

Parameters:
xid - transaction identifier
Returns:
the new transaction context


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.