java.lang.Object
org.springframework.batch.core.job.flow.support.state.AbstractState
org.springframework.batch.core.job.flow.support.state.SplitState
All Implemented Interfaces:
FlowHolder, State

public class SplitState extends AbstractState implements FlowHolder
A State implementation that splits a Flow into multiple parallel subflows.
Since:
2.0
Author:
Dave Syer, Mahmoud Ben Hassine
  • Constructor Details

    • SplitState

      public SplitState(Collection<Flow> flows, String name)
      Parameters:
      flows - collection of Flow instances.
      name - the name of the state.
    • SplitState

      public SplitState(Collection<Flow> flows, String name, @Nullable SplitState parentSplit)
      Parameters:
      flows - collection of Flow instances.
      name - the name of the state.
      parentSplit - the parent SplitState.
  • Method Details

    • setTaskExecutor

      public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
      Public setter for the taskExecutor.
      Parameters:
      taskExecutor - the taskExecutor to set
    • getFlows

      public Collection<Flow> getFlows()
      Specified by:
      getFlows in interface FlowHolder
      Returns:
      the flows
    • handle

      public FlowExecutionStatus handle(FlowExecutor executor) throws Exception
      Execute the flows in parallel by passing them to the TaskExecutor and wait for all of them to finish before proceeding.
      Specified by:
      handle in interface State
      Specified by:
      handle in class AbstractState
      Parameters:
      executor - the context passed in by the caller
      Returns:
      a status for the execution
      Throws:
      Exception - if anything goes wrong
      See Also:
    • doAggregation

      protected FlowExecutionStatus doAggregation(Collection<FlowExecution> results, FlowExecutor executor)
    • isEndState

      public boolean isEndState()
      Description copied from interface: State
      Inquire as to whether a State is an end state. Implementations should return false if processing can continue, even if that would require a restart.
      Specified by:
      isEndState in interface State
      Returns:
      true if this State is the end of processing