Class AbstractPhaseEngine

java.lang.Object
bitronix.tm.twopc.AbstractPhaseEngine
Direct Known Subclasses:
Committer, Preparer, Rollbacker

public abstract class AbstractPhaseEngine extends Object
Abstract phase execution engine.
Author:
lorban
  • Constructor Details

    • AbstractPhaseEngine

      protected AbstractPhaseEngine(Executor executor)
  • 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). If Configuration.isAsynchronous2Pc() is true, all commands in a given position are sent in parallel by using the detected Executor implementation.
      Parameters:
      resourceManager - the XAResourceManager containing 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

      protected abstract boolean isParticipating(XAResourceHolderState xaResourceHolderState)
      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

      protected abstract Job createJob(XAResourceHolderState xaResourceHolderState)
      Create a Job that is going to execute the phase command on the given resource.
      Parameters:
      xaResourceHolderState - the resource that is going to receive a command.
      Returns:
      the Job that is going to execute the command.
    • logFailedResources

      protected void logFailedResources(PhaseException ex)
      Log exceptions that happened during a phase failure.
      Parameters:
      ex - the phase exception.
    • collectResourcesUniqueNames

      protected static Set<String> collectResourcesUniqueNames(List<XAResourceHolderState> resources)
    • collectNotInterestedResources

      protected static List<XAResourceHolderState> collectNotInterestedResources(List<XAResourceHolderState> allResources, List<XAResourceHolderState> interestedResources)