bitronix.tm.resource.common
Class AbstractXAResourceHolder

java.lang.Object
  extended by bitronix.tm.resource.common.AbstractXAStatefulHolder
      extended by bitronix.tm.resource.common.AbstractXAResourceHolder
All Implemented Interfaces:
XAResourceHolder, XAStatefulHolder
Direct Known Subclasses:
DualSessionWrapper, JdbcPooledConnection, RecoveryXAResourceHolder

public abstract class AbstractXAResourceHolder
extends AbstractXAStatefulHolder
implements XAResourceHolder

Implementation of all services required by a XAResourceHolder. This class keeps a list of all XAResourceHolderStates of the XAResourceHolder plus the currently active one. There is one per transaction in which this XAResourceHolder is enlisted plus all the suspended transactions in which it is enlisted as well.

© Bitronix Software

Author:
lorban

Field Summary
 
Fields inherited from interface bitronix.tm.resource.common.XAStatefulHolder
STATE_ACCESSIBLE, STATE_CLOSED, STATE_IN_POOL, STATE_NOT_ACCESSIBLE
 
Constructor Summary
AbstractXAResourceHolder()
           
 
Method Summary
 XAResourceHolderState getXAResourceHolderState()
          Get the XAResourceHolderState of this wrapped resource.
 boolean hasStateForXAResource(XAResourceHolder xaResourceHolder)
          Check if this XAResourceHolder contains a state for a specific XAResourceHolder.
 boolean isParticipatingInActiveGlobalTransaction()
          If this method returns false, then local transaction calls like Connection.commit() can be made.
 boolean removeXAResourceHolderState(XAResourceHolderState xaResourceHolderState)
          Remove the specified state from this wrapped resource.
 void setXAResourceHolderState(XAResourceHolderState xaResourceHolderState)
          Set the XAResourceHolderState of this wrapped resource.
 
Methods inherited from class bitronix.tm.resource.common.AbstractXAStatefulHolder
addStateChangeEventListener, getState, removeStateChangeEventListener, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bitronix.tm.resource.common.XAResourceHolder
getXAResource
 
Methods inherited from interface bitronix.tm.resource.common.XAStatefulHolder
addStateChangeEventListener, close, getConnectionHandle, getLastReleaseDate, getState, getXAResourceHolders, removeStateChangeEventListener, setState
 

Constructor Detail

AbstractXAResourceHolder

public AbstractXAResourceHolder()
Method Detail

getXAResourceHolderState

public XAResourceHolderState getXAResourceHolderState()
Description copied from interface: XAResourceHolder
Get the XAResourceHolderState of this wrapped resource.

Since a XAResourceHolder can participate in more than one transaction at a time (when suspending a context for instance) the transaction manager guarantees that the XAResourceHolderState related to the current transaction context will be returned.

Specified by:
getXAResourceHolderState in interface XAResourceHolder
Returns:
the XAResourceHolderState.

setXAResourceHolderState

public void setXAResourceHolderState(XAResourceHolderState xaResourceHolderState)
Description copied from interface: XAResourceHolder
Set the XAResourceHolderState of this wrapped resource.

Specified by:
setXAResourceHolderState in interface XAResourceHolder
Parameters:
xaResourceHolderState - the XAResourceHolderState to set.

removeXAResourceHolderState

public boolean removeXAResourceHolderState(XAResourceHolderState xaResourceHolderState)
Description copied from interface: XAResourceHolder
Remove the specified state from this wrapped resource.

Specified by:
removeXAResourceHolderState in interface XAResourceHolder
Parameters:
xaResourceHolderState - the XAResourceHolderState to remove.
Returns:
true if the state actually existed before removal, false otherwise.

hasStateForXAResource

public boolean hasStateForXAResource(XAResourceHolder xaResourceHolder)
Description copied from interface: XAResourceHolder
Check if this XAResourceHolder contains a state for a specific XAResourceHolder. In other words: has the XAResourceHolder's XAResource been enlisted in some transaction ?

Specified by:
hasStateForXAResource in interface XAResourceHolder
Parameters:
xaResourceHolder - the XAResourceHolder to look for.
Returns:
true if the XAResourceHolder is enlisted in some transaction, false otherwise.

isParticipatingInActiveGlobalTransaction

public boolean isParticipatingInActiveGlobalTransaction()
If this method returns false, then local transaction calls like Connection.commit() can be made.

Returns:
true if start() has been successfully called but not end() yet and the transaction is not suspended.