|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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()
|
java.util.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(org.springframework.core.task.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 java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic 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(org.springframework.core.task.TaskExecutor taskExecutor)
TaskExecutor that is used to farm out step
executions to multiple threads.
taskExecutor - a TaskExecutorpublic 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 logic
public java.util.Collection<StepExecution> handle(StepExecutionSplitter stepExecutionSplitter,
StepExecution masterStepExecution)
throws java.lang.Exception
PartitionHandlerPartitionHandler 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 PartitionHandlerstepExecutionSplitter - a strategy for generating a collection of
StepExecution instancesmasterStepExecution - the master step execution for the whole partition
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.PartitionHandler.handle(StepExecutionSplitter, StepExecution)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||