类 TaskExecutorPartitionHandler
- java.lang.Object
- org.springframework.batch.core.partition.support.AbstractPartitionHandler
- org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler
- 所有已实现的接口:
PartitionHandler
,StepHolder
,org.springframework.beans.factory.InitializingBean
public class TaskExecutorPartitionHandler extends AbstractPartitionHandler implements StepHolder, org.springframework.beans.factory.InitializingBean
APartitionHandler
that uses aTaskExecutor
to execute the partitionedStep
locally in multiple threads. This can be an effective approach for scaling batch steps that are IO intensive, like directory and filesystem scanning and copying.
By default, the thread pool is synchronous.- 从以下版本开始:
- 2.0
- 作者:
- Sebastien Gerard, Dave Syer
构造器概要
构造器 构造器 说明 TaskExecutorPartitionHandler()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
protected java.util.concurrent.FutureTask<StepExecution>
createTask(Step step, StepExecution stepExecution)
Creates the task executing the given step in the context of the given execution.protected java.util.Set<StepExecution>
doHandle(StepExecution masterStepExecution, java.util.Set<StepExecution> partitionStepExecutions)
Executes the specifiedStepExecution
instances and returns an updated view of them.Step
getStep()
The step instance that will be executed in parallel by this handler.void
setStep(Step step)
Setter for theStep
that will be used to execute the partitionedStepExecution
.void
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Setter for theTaskExecutor
that is used to farm out step executions to multiple threads.从类继承的方法 org.springframework.batch.core.partition.support.AbstractPartitionHandler
getGridSize, handle, setGridSize
构造器详细资料
TaskExecutorPartitionHandler
public TaskExecutorPartitionHandler()
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Setter for theTaskExecutor
that is used to farm out step executions to multiple threads.- 参数:
taskExecutor
- aTaskExecutor
setStep
public void setStep(Step step)
Setter for theStep
that will be used to execute the partitionedStepExecution
. This is a regular Spring Batch step, with all the business logic required to complete an execution based on the input parameters in itsStepExecution
context.- 参数:
step
- theStep
instance to use to execute business logic
getStep
public Step getStep()
The step instance that will be executed in parallel by this handler.- 指定者:
getStep
在接口中StepHolder
- 返回:
- the step instance that will be used
- 另请参阅:
StepHolder.getStep()
doHandle
protected java.util.Set<StepExecution> doHandle(StepExecution masterStepExecution, java.util.Set<StepExecution> partitionStepExecutions) throws java.lang.Exception
从类复制的说明:AbstractPartitionHandler
Executes the specifiedStepExecution
instances and returns an updated view of them. Throws anException
if anything goes wrong.- 指定者:
doHandle
在类中AbstractPartitionHandler
- 参数:
masterStepExecution
- the whole partition executionpartitionStepExecutions
- theStepExecution
instances to execute- 返回:
- an updated view of these completed
StepExecution
instances - 抛出:
java.lang.Exception
- 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.
createTask
protected java.util.concurrent.FutureTask<StepExecution> createTask(Step step, StepExecution stepExecution)
Creates the task executing the given step in the context of the given execution.- 参数:
step
- the step to executestepExecution
- the given execution- 返回:
- the task executing the given step