类 SimpleStepExecutionSplitter
- java.lang.Object
- org.springframework.batch.core.partition.support.SimpleStepExecutionSplitter
- 所有已实现的接口:
StepExecutionSplitter
,org.springframework.beans.factory.InitializingBean
- 直接已知子类:
JsrStepExecutionSplitter
public class SimpleStepExecutionSplitter extends java.lang.Object implements StepExecutionSplitter, org.springframework.beans.factory.InitializingBean
Generic implementation ofStepExecutionSplitter
that delegates to aPartitioner
to generateExecutionContext
instances. Takes care of restartability and identifying the step executions from previous runs of the same job. The generatedStepExecution
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 thePartitioner
identifiers, separated by a colon, e.g.{step1:partition0, step1:partition1, ...}
.- 从以下版本开始:
- 2.0
- 作者:
- Dave Syer, Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 SimpleStepExecutionSplitter()
Default constructor for convenience in configuration.SimpleStepExecutionSplitter(JobRepository jobRepository, boolean allowStartIfComplete, java.lang.String stepName, Partitioner partitioner)
Construct aSimpleStepExecutionSplitter
from its mandatory properties.SimpleStepExecutionSplitter(JobRepository jobRepository, Step step, Partitioner partitioner)
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Check mandatory properties (step name, job repository and partitioner).protected boolean
getStartable(StepExecution stepExecution, ExecutionContext context)
已过时。This method is deprecated in favor ofisStartable(org.springframework.batch.core.StepExecution, org.springframework.batch.item.ExecutionContext)
and will be removed in a future version.java.lang.String
getStepName()
The name of the step configuration that will be executed remotely.protected boolean
isStartable(StepExecution stepExecution, ExecutionContext context)
Check if a step execution is startable.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)
ThePartitioner
that will be used to generate step execution meta data for the target step.void
setStepName(java.lang.String stepName)
The name of the target step that will be executed across the partitions.java.util.Set<StepExecution>
split(StepExecution stepExecution, int gridSize)
Partition the providedStepExecution
into a set of parallel executable instances with the same parentJobExecution
.
构造器详细资料
SimpleStepExecutionSplitter
public SimpleStepExecutionSplitter()
Default constructor for convenience in configuration.
SimpleStepExecutionSplitter
public SimpleStepExecutionSplitter(JobRepository jobRepository, boolean allowStartIfComplete, java.lang.String stepName, Partitioner partitioner)
Construct aSimpleStepExecutionSplitter
from its mandatory properties.- 参数:
jobRepository
- theJobRepository
allowStartIfComplete
- flag specifying preferences on restartstepName
- the target step namepartitioner
- aPartitioner
to use for generating input parameters
SimpleStepExecutionSplitter
@Deprecated public SimpleStepExecutionSplitter(JobRepository jobRepository, Step step, Partitioner partitioner)
Construct aSimpleStepExecutionSplitter
from its mandatory properties.- 参数:
jobRepository
- theJobRepository
step
- the target step (a local version of it), used to extract the name and allowStartIfComplete flagspartitioner
- aPartitioner
to use for generating input parameters
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Check mandatory properties (step name, job repository and partitioner).- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
- 另请参阅:
InitializingBean.afterPropertiesSet()
setAllowStartIfComplete
public void setAllowStartIfComplete(boolean allowStartIfComplete)
Flag to indicate that the partition target step is allowed to start if an execution is complete. Defaults to the same value as the underlying step. Set this manually to override the underlying step properties.- 参数:
allowStartIfComplete
- the value to set- 另请参阅:
Step.isAllowStartIfComplete()
setJobRepository
public void setJobRepository(JobRepository jobRepository)
The job repository that will be used to manage the persistence of the delegate step executions.- 参数:
jobRepository
- the JobRepository to set
setPartitioner
public void setPartitioner(Partitioner partitioner)
ThePartitioner
that will be used to generate step execution meta data for the target step.- 参数:
partitioner
- the partitioner to set
setStepName
public void setStepName(java.lang.String stepName)
The name of the target step that will be executed across the partitions. Mandatory with no default.- 参数:
stepName
- the step name to set
getStepName
public java.lang.String getStepName()
从接口复制的说明:StepExecutionSplitter
The name of the step configuration that will be executed remotely. Remote workers are going to execute a the same step for each execution context in the partition.- 指定者:
getStepName
在接口中StepExecutionSplitter
- 返回:
- the name of the step that will execute the business logic
- 另请参阅:
StepExecutionSplitter.getStepName()
split
public java.util.Set<StepExecution> split(StepExecution stepExecution, int gridSize) throws JobExecutionException
从接口复制的说明:StepExecutionSplitter
Partition the providedStepExecution
into a set of parallel executable instances with the same parentJobExecution
. 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.
On a restart clients of theStepExecutionSplitter
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
在接口中StepExecutionSplitter
- 参数:
stepExecution
- theStepExecution
to be partitioned.gridSize
- a hint for the splitter if the size of the grid is known- 返回:
- a set of
StepExecution
instances for remote processing - 抛出:
JobExecutionException
- if the split cannot be made- 另请参阅:
StepExecutionSplitter.split(StepExecution, int)
isStartable
protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException
Check if a step execution is startable.- 参数:
stepExecution
- the step execution to checkcontext
- the execution context of the step- 返回:
- true if the step execution is startable, false otherwise
- 抛出:
JobExecutionException
- if unable to check if the step execution is startable
getStartable
@Deprecated protected boolean getStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException
已过时。This method is deprecated in favor ofisStartable(org.springframework.batch.core.StepExecution, org.springframework.batch.item.ExecutionContext)
and will be removed in a future version.Check if a step execution is startable.- 参数:
stepExecution
- the step execution to checkcontext
- the execution context of the step- 返回:
- true if the step execution is startable, false otherwise
- 抛出:
JobExecutionException
- if unable to check if the step execution is startable