public abstract class AbstractPartitionHandler extends Object implements PartitionHandler
PartitionHandler
implementation providing common base
features. Subclasses are expected to implement only the
doHandle(org.springframework.batch.core.StepExecution, java.util.Set)
method which returns with the result of the execution(s) or an exception if
the step failed to process.Constructor and Description |
---|
AbstractPartitionHandler() |
Modifier and Type | Method and Description |
---|---|
protected abstract Set<StepExecution> |
doHandle(StepExecution masterStepExecution,
Set<StepExecution> partitionStepExecutions)
Executes the specified
StepExecution instances and returns an updated
view of them. |
int |
getGridSize()
Returns the number of step executions.
|
Collection<StepExecution> |
handle(StepExecutionSplitter stepSplitter,
StepExecution masterStepExecution)
Main entry point for
PartitionHandler interface. |
void |
setGridSize(int gridSize)
Passed to the
StepExecutionSplitter in the
handle(StepExecutionSplitter, StepExecution) method, instructing
it how many StepExecution instances are required, ideally. |
protected abstract Set<StepExecution> doHandle(StepExecution masterStepExecution, Set<StepExecution> partitionStepExecutions) throws Exception
StepExecution
instances and returns an updated
view of them. Throws an Exception
if anything goes wrong.masterStepExecution
- the whole partition executionpartitionStepExecutions
- the StepExecution
instances to executeStepExecution
instancesException
- if anything goes wrong. This allows implementations to
be liberal and rely on the caller to translate an exception into a step
failure as necessary.public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution masterStepExecution) throws Exception
PartitionHandler
PartitionHandler
interface. The splitter
creates all the executions that need to be farmed out, along with their
input parameters (in the form of their ExecutionContext
). The
master step execution is used to identify the partition and group
together the results logically.handle
in interface PartitionHandler
stepSplitter
- a strategy for generating a collection of
StepExecution
instancesmasterStepExecution
- the master step execution for the whole partitionStepExecution
instancesException
- if anything goes wrong. This allows implementations to
be liberal and rely on the caller to translate an exception into a step
failure as necessary.PartitionHandler.handle(StepExecutionSplitter, StepExecution)
public int getGridSize()
public void setGridSize(int gridSize)
StepExecutionSplitter
in the
handle(StepExecutionSplitter, StepExecution)
method, instructing
it how many StepExecution
instances are required, ideally. The
StepExecutionSplitter
is allowed to ignore the grid size in the
case of a restart, since the input data partitions must be preserved.gridSize
- the number of step executions that will be createdCopyright © 2014 Pivotal. All rights reserved.