Package bitronix.tm.resource.common
Class AbstractXAResourceHolder
java.lang.Object
bitronix.tm.resource.common.AbstractXAStatefulHolder
bitronix.tm.resource.common.AbstractXAResourceHolder
- All Implemented Interfaces:
XAResourceHolder,XAStatefulHolder
- Direct Known Subclasses:
DualSessionWrapper,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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSimple helper method which returns a set of GTRIDs of transactions in which this resource is enlisted.Get all theXAResourceHolderStates of this wrapped resource for a specific GTRID.booleanhasStateForXAResource(XAResourceHolder xaResourceHolder) Check if thisXAResourceHoldercontains a state for a specificXAResourceHolder.booleanIf this method returns false, then local transaction calls like Connection.commit() can be made.voidputXAResourceHolderState(BitronixXid xid, XAResourceHolderState xaResourceHolderState) Add aXAResourceHolderStateof this wrapped resource.voidRemove all states related to a specific Xid from this wrapped resource.Methods inherited from class bitronix.tm.resource.common.AbstractXAStatefulHolder
addStateChangeEventListener, getState, removeStateChangeEventListener, setStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface bitronix.tm.resource.common.XAResourceHolder
getResourceBean, getXAResourceMethods inherited from interface bitronix.tm.resource.common.XAStatefulHolder
addStateChangeEventListener, close, getConnectionHandle, getLastReleaseDate, getState, getXAResourceHolders, removeStateChangeEventListener, setState
-
Constructor Details
-
AbstractXAResourceHolder
public AbstractXAResourceHolder()
-
-
Method Details
-
getXAResourceHolderStatesForGtrid
Description copied from interface:XAResourceHolderGet all theXAResourceHolderStates 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:
getXAResourceHolderStatesForGtridin interfaceXAResourceHolder- Parameters:
gtrid- the GTRID of the transaction state to add.- Returns:
- the
XAResourceHolderState.
-
putXAResourceHolderState
Description copied from interface:XAResourceHolderAdd aXAResourceHolderStateof this wrapped resource.- Specified by:
putXAResourceHolderStatein interfaceXAResourceHolder- Parameters:
xid- the Xid of the transaction state to add.xaResourceHolderState- theXAResourceHolderStateto set.
-
removeXAResourceHolderState
Description copied from interface:XAResourceHolderRemove all states related to a specific Xid from this wrapped resource.- Specified by:
removeXAResourceHolderStatein interfaceXAResourceHolder- Parameters:
xid- the Xid of the transaction state to remove.
-
hasStateForXAResource
Description copied from interface:XAResourceHolderCheck if thisXAResourceHoldercontains a state for a specificXAResourceHolder. In other words: has theXAResourceHolder'sXAResourcebeen enlisted in some transaction ?- Specified by:
hasStateForXAResourcein interfaceXAResourceHolder- Parameters:
xaResourceHolder- theXAResourceHolderto look for.- Returns:
- true if the
XAResourceHolderis 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
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.
-