public class SimpleStepExecutionSplitter extends Object implements StepExecutionSplitter, org.springframework.beans.factory.InitializingBean
StepExecutionSplitter
that delegates to a
Partitioner
to generate ExecutionContext
instances. Takes
care of restartability and identifying the step executions from previous runs
of the same job. The generated StepExecution
instances have names
that identify them uniquely in the partition. The name is constructed from a
base (name of the target step) plus a suffix taken from the
Partitioner
identifiers, separated by a colon, e.g.
{step1:partition0, step1:partition1, ...}
.Constructor and Description |
---|
SimpleStepExecutionSplitter()
Default constructor for convenience in configuration.
|
SimpleStepExecutionSplitter(JobRepository jobRepository,
boolean allowStartIfComplete,
String stepName,
Partitioner partitioner)
Construct a
SimpleStepExecutionSplitter from its mandatory
properties. |
SimpleStepExecutionSplitter(JobRepository jobRepository,
Step step,
Partitioner partitioner)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Check mandatory properties (step name, job repository and partitioner).
|
String |
getStepName()
The name of the step configuration that will be executed remotely.
|
void |
setAllowStartIfComplete(boolean allowStartIfComplete)
Flag to indicate that the partition target step is allowed to start if an
execution is complete.
|
void |
setJobRepository(JobRepository jobRepository)
The job repository that will be used to manage the persistence of the
delegate step executions.
|
void |
setPartitioner(Partitioner partitioner)
The
Partitioner that will be used to generate step execution meta
data for the target step. |
void |
setStepName(String stepName)
The name of the target step that will be executed across the partitions.
|
Set<StepExecution> |
split(StepExecution stepExecution,
int gridSize)
Partition the provided
StepExecution into a set of parallel
executable instances with the same parent JobExecution . |
public SimpleStepExecutionSplitter()
public SimpleStepExecutionSplitter(JobRepository jobRepository, boolean allowStartIfComplete, String stepName, Partitioner partitioner)
SimpleStepExecutionSplitter
from its mandatory
properties.jobRepository
- the JobRepository
allowStartIfComplete
- flag specifying preferences on restartstepName
- the target step namepartitioner
- a Partitioner
to use for generating input
parameters@Deprecated public SimpleStepExecutionSplitter(JobRepository jobRepository, Step step, Partitioner partitioner)
SimpleStepExecutionSplitter(JobRepository, boolean, String, Partitioner)
insteadSimpleStepExecutionSplitter
from its mandatory
properties.jobRepository
- the JobRepository
step
- the target step (a local version of it), used to extract the
name and allowStartIfComplete flagspartitioner
- a Partitioner
to use for generating input
parameterspublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
InitializingBean.afterPropertiesSet()
public void setAllowStartIfComplete(boolean allowStartIfComplete)
allowStartIfComplete
- the value to setStep.isAllowStartIfComplete()
public void setJobRepository(JobRepository jobRepository)
jobRepository
- the JobRepository to setpublic void setPartitioner(Partitioner partitioner)
Partitioner
that will be used to generate step execution meta
data for the target step.partitioner
- the partitioner to setpublic void setStepName(String stepName)
stepName
- the step name to setpublic String getStepName()
StepExecutionSplitter
getStepName
in interface StepExecutionSplitter
StepExecutionSplitter.getStepName()
public Set<StepExecution> split(StepExecution stepExecution, int gridSize) throws JobExecutionException
StepExecutionSplitter
StepExecution
into a set of parallel
executable instances with the same parent JobExecution
. The grid
size will be treated as a hint for the size of the collection to be
returned. It may or may not correspond to the physical size of an
execution grid.StepExecutionSplitter
should expect
it to reconstitute the state of the last failed execution and only return
those executions that need to be restarted. Thus the grid size hint will
be ignored on a restart.split
in interface StepExecutionSplitter
stepExecution
- the StepExecution
to be partitioned.gridSize
- a hint for the splitter if the size of the grid is knownStepExecution
instances for remote processingJobExecutionException
- if the split cannot be madeStepExecutionSplitter.split(StepExecution, int)
Copyright © 2014 Pivotal. All rights reserved.