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, EhCacheXAResourceHolder, 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.

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
 Set getXAResourceHolderStateGtrids()
          Simple helper method which returns a set of GTRIDs of transactions in which this resource is enlisted.
 Map getXAResourceHolderStatesForGtrid(Uid gtrid)
          Get all the XAResourceHolderStates of this wrapped resource for a specific GTRID.
 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.
 void putXAResourceHolderState(BitronixXid xid, XAResourceHolderState xaResourceHolderState)
          Add a XAResourceHolderState of this wrapped resource.
 void removeXAResourceHolderState(BitronixXid xid)
          Remove all states related to a specific Xid from 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
getResourceBean, 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

getXAResourceHolderStatesForGtrid

public Map getXAResourceHolderStatesForGtrid(Uid gtrid)
Description copied from interface: XAResourceHolder
Get all the XAResourceHolderStates of this wrapped resource for a specific GTRID.

The returned Map is guaranteed to return states in order they were added when its values are iterated.

Specified by:
getXAResourceHolderStatesForGtrid in interface XAResourceHolder
Parameters:
gtrid - the GTRID of the transaction state to add.
Returns:
the XAResourceHolderState.

putXAResourceHolderState

public void putXAResourceHolderState(BitronixXid xid,
                                     XAResourceHolderState xaResourceHolderState)
Description copied from interface: XAResourceHolder
Add a XAResourceHolderState of this wrapped resource.

Specified by:
putXAResourceHolderState in interface XAResourceHolder
Parameters:
xid - the Xid of the transaction state to add.
xaResourceHolderState - the XAResourceHolderState to set.

removeXAResourceHolderState

public void removeXAResourceHolderState(BitronixXid xid)
Description copied from interface: XAResourceHolder
Remove all states related to a specific Xid from this wrapped resource.

Specified by:
removeXAResourceHolderState in interface XAResourceHolder
Parameters:
xid - the Xid of the transaction state to remove.

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.

getXAResourceHolderStateGtrids

public Set getXAResourceHolderStateGtrids()
Simple helper method which returns a set of GTRIDs of transactions in which this resource is enlisted. Useful for monitoring.

Returns:
a set of String-encoded GTRIDs of transactions in which this resource is enlisted.


Copyright © 2006-2011 Bitronix Software. All Rights Reserved.