|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler
public class TaskExecutorPartitionHandler
A PartitionHandler
that uses a TaskExecutor
to execute the
partitioned Step
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.
Constructor Summary | |
---|---|
TaskExecutorPartitionHandler()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
Step |
getStep()
The step instance that will be executed in parallel by this handler. |
Collection<StepExecution> |
handle(StepExecutionSplitter stepExecutionSplitter,
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. |
void |
setStep(Step step)
Setter for the Step that will be used to execute the partitioned
StepExecution . |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Setter for the TaskExecutor that is used to farm out step
executions to multiple threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TaskExecutorPartitionHandler()
Method Detail |
---|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
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 createdpublic void setTaskExecutor(TaskExecutor taskExecutor)
TaskExecutor
that is used to farm out step
executions to multiple threads.
taskExecutor
- a TaskExecutor
public void setStep(Step step)
Step
that will be used to execute the partitioned
StepExecution
. This is a regular Spring Batch step, with all the
business logic required to complete an execution based on the input
parameters in its StepExecution
context.
step
- the Step
instance to use to execute business logicpublic Step getStep()
getStep
in interface StepHolder
StepHolder.getStep()
public Collection<StepExecution> handle(StepExecutionSplitter stepExecutionSplitter, 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
stepExecutionSplitter
- a strategy for generating a collection of
StepExecution
instancesmasterStepExecution
- the master step execution for the whole partition
StepExecution
instances
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.PartitionHandler.handle(StepExecutionSplitter, StepExecution)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |