public abstract class AbstractXAResourceHolder<T extends XAResourceHolder<T>> extends AbstractXAStatefulHolder<T> implements XAResourceHolder<T>
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.XAStatefulHolder.State| Constructor and Description |
|---|
AbstractXAResourceHolder() |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptVisitorForXAResourceHolderStates(Uid gtrid,
XAResourceHolderStateVisitor visitor)
This method implements a standard Visitor Pattern.
|
int |
getXAResourceHolderStateCountForGtrid(Uid gtrid)
Get a count of
XAResourceHolderStates for the specified GTRID. |
Set<String> |
getXAResourceHolderStateGtrids()
Simple helper method which returns a set of GTRIDs of transactions in which
this resource is enlisted.
|
protected Map<Uid,XAResourceHolderState> |
getXAResourceHolderStatesForGtrid(Uid gtrid) |
boolean |
hasStateForXAResource(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder)
Check if this
XAResourceHolder contains a state for a specific XAResourceHolder. |
boolean |
isExistXAResourceHolderStatesForGtrid(Uid gtrid)
Checks whether there are
XAResourceHolderStates for the specified GTRID. |
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.
|
addStateChangeEventListener, getCreationDate, getState, removeStateChangeEventListener, setStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetResourceBean, getXAResourceaddStateChangeEventListener, close, getConnectionHandle, getCreationDate, getLastReleaseDate, getState, getXAResourceHolders, removeStateChangeEventListener, setStateprotected Map<Uid,XAResourceHolderState> getXAResourceHolderStatesForGtrid(Uid gtrid)
public boolean isExistXAResourceHolderStatesForGtrid(Uid gtrid)
XAResourceHolderXAResourceHolderStates for the specified GTRID.isExistXAResourceHolderStatesForGtrid in interface XAResourceHolder<T extends XAResourceHolder<T>>gtrid - the GTRID of the transaction state to check existence forXAResourceHolderStates, false otherwisepublic int getXAResourceHolderStateCountForGtrid(Uid gtrid)
XAResourceHolderXAResourceHolderStates for the specified GTRID.getXAResourceHolderStateCountForGtrid in interface XAResourceHolder<T extends XAResourceHolder<T>>gtrid - the GTRID to get a XAResourceHolderState count forXAResourceHolderStates, or 0 if there are no states for the
specified GTRIDpublic void acceptVisitorForXAResourceHolderStates(Uid gtrid, XAResourceHolderStateVisitor visitor)
XAResourceHolderXAResourceHolderStateVisitor's visit() method is called for each matching
XAResourceHolderState in the order they were added. This method was introduced
as a replacement for the old getXAResourceHolderStatesForGtrid(Uid) method. The old
getXAResourceHolderStatesForGtrid method exported an internal collection which was unsynchronized
yet was iterated over by the callers. Using the Visitor Pattern allows us to perform the same
iteration within the context of a lock, and avoids exposing internal state and implementation
details to callers.acceptVisitorForXAResourceHolderStates in interface XAResourceHolder<T extends XAResourceHolder<T>>gtrid - the GTRID of the transaction state to visit XAResourceHolderStates forvisitor - a XAResourceHolderStateVisitor instancepublic void putXAResourceHolderState(BitronixXid xid, XAResourceHolderState xaResourceHolderState)
XAResourceHolderXAResourceHolderState of this wrapped resource.putXAResourceHolderState in interface XAResourceHolder<T extends XAResourceHolder<T>>xid - the Xid of the transaction state to add.xaResourceHolderState - the XAResourceHolderState to set.public void removeXAResourceHolderState(BitronixXid xid)
XAResourceHolderremoveXAResourceHolderState in interface XAResourceHolder<T extends XAResourceHolder<T>>xid - the Xid of the transaction state to remove.public boolean hasStateForXAResource(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder)
XAResourceHolderXAResourceHolder contains a state for a specific XAResourceHolder.
In other words: has the XAResourceHolder's XAResource been enlisted in some transaction ?hasStateForXAResource in interface XAResourceHolder<T extends XAResourceHolder<T>>xaResourceHolder - the XAResourceHolder to look for.XAResourceHolder is enlisted in some transaction, false otherwise.public boolean isParticipatingInActiveGlobalTransaction()
public Set<String> getXAResourceHolderStateGtrids()
Copyright © 2006-2016 Bitronix Software. All Rights Reserved.