Package bitronix.tm.twopc
Class AbstractPhaseEngine
java.lang.Object
bitronix.tm.twopc.AbstractPhaseEngine
- Direct Known Subclasses:
Committer,Preparer,Rollbacker
Abstract phase execution engine.
- Author:
- lorban
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static List<XAResourceHolderState>collectNotInterestedResources(List<XAResourceHolderState> allResources, List<XAResourceHolderState> interestedResources) collectResourcesUniqueNames(List<XAResourceHolderState> resources) protected abstract JobcreateJob(XAResourceHolderState xaResourceHolderState) Create aJobthat is going to execute the phase command on the given resource.protected voidexecutePhase(XAResourceManager resourceManager, boolean reverse) Execute the phase.protected abstract booleanisParticipating(XAResourceHolderState xaResourceHolderState) Determine if a resource is participating in the phase or not.protected voidLog exceptions that happened during a phase failure.
-
Constructor Details
-
AbstractPhaseEngine
-
-
Method Details
-
executePhase
protected void executePhase(XAResourceManager resourceManager, boolean reverse) throws PhaseException Execute the phase. Resources receive the phase command in position order (reversed or not). If there is more than once resource in a position, command is sent in enlistment order (again reversed or not). IfConfiguration.isAsynchronous2Pc()is true, all commands in a given position are sent in parallel by using the detectedExecutorimplementation.- Parameters:
resourceManager- theXAResourceManagercontaining the enlisted resources to execute the phase on.reverse- true if jobs should be executed in reverse position / enlistment order, false for natural position / enlistment order.- Throws:
PhaseException- if one or more resource threw an exception during phase execution.- See Also:
-
isParticipating
Determine if a resource is participating in the phase or not. A participating resource gets a job created to execute the phase's command on it.- Parameters:
xaResourceHolderState- the resource to check for its participation.- Returns:
- true if the resource must participate in the phase.
-
createJob
Create aJobthat is going to execute the phase command on the given resource.- Parameters:
xaResourceHolderState- the resource that is going to receive a command.- Returns:
- the
Jobthat is going to execute the command.
-
logFailedResources
Log exceptions that happened during a phase failure.- Parameters:
ex- the phase exception.
-
collectResourcesUniqueNames
-
collectNotInterestedResources
protected static List<XAResourceHolderState> collectNotInterestedResources(List<XAResourceHolderState> allResources, List<XAResourceHolderState> interestedResources)
-