类 PartitionStepBuilder
- java.lang.Object
- org.springframework.batch.core.step.builder.StepBuilderHelper<PartitionStepBuilder>
- org.springframework.batch.core.step.builder.PartitionStepBuilder
public class PartitionStepBuilder extends StepBuilderHelper<PartitionStepBuilder>
Step builder forPartitionStep
instances. A partition step executes the same step (possibly remotely) multiple times with different input parameters (in the form of execution context). Useful for parallelization.- 从以下版本开始:
- 2.2
- 作者:
- Dave Syer, Mahmoud Ben Hassine, Dimitrios Liapis
嵌套类概要
从类继承的嵌套类/接口 org.springframework.batch.core.step.builder.StepBuilderHelper
StepBuilderHelper.CommonStepProperties
字段概要
从类继承的字段 org.springframework.batch.core.step.builder.StepBuilderHelper
logger, properties
构造器概要
构造器 构造器 说明 PartitionStepBuilder(StepBuilderHelper<?> parent)
Create a new builder initialized with any properties in the parent.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 PartitionStepBuilder
aggregator(StepExecutionAggregator aggregator)
Provide a step execution aggregator for aggregating partitioned step executions into a single result for thePartitionStep
itself.Step
build()
protected StepExecutionAggregator
getAggregator()
protected int
getGridSize()
protected Partitioner
getPartitioner()
protected PartitionHandler
getPartitionHandler()
protected StepExecutionSplitter
getSplitter()
protected Step
getStep()
protected java.lang.String
getStepName()
protected org.springframework.core.task.TaskExecutor
getTaskExecutor()
PartitionStepBuilder
gridSize(int gridSize)
A hint to thesplitter(StepExecutionSplitter)
about how many step executions are required.PartitionStepBuilder
partitioner(java.lang.String slaveStepName, Partitioner partitioner)
Add a partitioner which can be used to create aStepExecutionSplitter
.PartitionStepBuilder
partitionHandler(PartitionHandler partitionHandler)
Provide an explicit partition handler that will carry out the work of the partition step.PartitionStepBuilder
splitter(StepExecutionSplitter splitter)
Provide an explicitStepExecutionSplitter
instead of having one build from thepartitioner(String, Partitioner)
.PartitionStepBuilder
step(Step step)
Provide an actual step instance to execute in parallel.PartitionStepBuilder
taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Provide a task executor to use when constructing aPartitionHandler
from thestep(Step)
.从类继承的方法 org.springframework.batch.core.step.builder.StepBuilderHelper
allowStartIfComplete, enhance, getJobRepository, getName, getTransactionManager, isAllowStartIfComplete, listener, listener, repository, startLimit, transactionManager
构造器详细资料
PartitionStepBuilder
public PartitionStepBuilder(StepBuilderHelper<?> parent)
Create a new builder initialized with any properties in the parent. The parent is copied, so it can be re-used.- 参数:
parent
- a parent helper containing common step properties
方法详细资料
partitioner
public PartitionStepBuilder partitioner(java.lang.String slaveStepName, Partitioner partitioner)
Add a partitioner which can be used to create aStepExecutionSplitter
. Use either this or an explicitsplitter(StepExecutionSplitter)
but not both.- 参数:
slaveStepName
- the name of the slave step (used to construct step execution names)partitioner
- a partitioner to use- 返回:
- this for fluent chaining
step
public PartitionStepBuilder step(Step step)
Provide an actual step instance to execute in parallel. If an explicitpartitionHandler(PartitionHandler)
is provided, the step is optional and is only used to extract configuration data (name and other basic properties of a step).- 参数:
step
- a step to execute in parallel- 返回:
- this for fluent chaining
taskExecutor
public PartitionStepBuilder taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Provide a task executor to use when constructing aPartitionHandler
from thestep(Step)
. Mainly used for running a step locally in parallel, but can be used to execute remotely if the step is remote. Not used if an explicitpartitionHandler(PartitionHandler)
is provided.- 参数:
taskExecutor
- a task executor to use when executing steps in parallel- 返回:
- this for fluent chaining
partitionHandler
public PartitionStepBuilder partitionHandler(PartitionHandler partitionHandler)
Provide an explicit partition handler that will carry out the work of the partition step. The partition handler is the main SPI for adapting a partition step to a specific distributed computation environment. Optional if you only need local or remote processing through the Step interface.- 参数:
partitionHandler
- a partition handler- 返回:
- this for fluent chaining
- 另请参阅:
for setting up a default handler that works with a local or remote Step
gridSize
public PartitionStepBuilder gridSize(int gridSize)
A hint to thesplitter(StepExecutionSplitter)
about how many step executions are required. If running locally or remotely through ataskExecutor(TaskExecutor)
determines precisely the number of step executions in the first attempt at a partition step execution.- 参数:
gridSize
- the grid size- 返回:
- this for fluent chaining
splitter
public PartitionStepBuilder splitter(StepExecutionSplitter splitter)
Provide an explicitStepExecutionSplitter
instead of having one build from thepartitioner(String, Partitioner)
. Useful if you need more control over the splitting.- 参数:
splitter
- a step execution splitter- 返回:
- this for fluent chaining
aggregator
public PartitionStepBuilder aggregator(StepExecutionAggregator aggregator)
Provide a step execution aggregator for aggregating partitioned step executions into a single result for thePartitionStep
itself. Default is a simple implementation that works in most cases.- 参数:
aggregator
- a step execution aggregator- 返回:
- this for fluent chaining
getTaskExecutor
protected org.springframework.core.task.TaskExecutor getTaskExecutor()
getPartitioner
protected Partitioner getPartitioner()
getPartitionHandler
protected PartitionHandler getPartitionHandler()
getGridSize
protected int getGridSize()
getSplitter
protected StepExecutionSplitter getSplitter()
getAggregator
protected StepExecutionAggregator getAggregator()
getStepName
protected java.lang.String getStepName()