public class TaskExecutorPartitionHandler extends AbstractPartitionHandler implements StepHolder, org.springframework.beans.factory.InitializingBean
TaskExecutor
を使用して、パーティション化された Step
を複数のスレッドでローカルに実行する PartitionHandler
。これは、ディレクトリやファイルシステムのスキャンやコピーなど、IO を集中的に使用するバッチステップをスケーリングするための効果的なアプローチです。コンストラクターと説明 |
---|
TaskExecutorPartitionHandler() |
修飾子と型 | メソッドと説明 |
---|---|
void | afterPropertiesSet() |
protected java.util.concurrent.FutureTask<StepExecution> | createTask(Step step, StepExecution stepExecution) 指定された実行のコンテキストで指定されたステップを実行するタスクを作成します。 |
protected java.util.Set<StepExecution> | doHandle(StepExecution managerStepExecution, java.util.Set<StepExecution> partitionStepExecutions) 指定された StepExecution インスタンスを実行し、それらの更新されたビューを返します。 |
Step | getStep() このハンドラーによって並行して実行されるステップインスタンス。 |
void | setStep(Step step) パーティション化された StepExecution の実行に使用される Step の Setter。 |
void | setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) ステップ実行を複数のスレッドにファームアウトするために使用される TaskExecutor の Setter。 |
getGridSize, handle, setGridSize
public void afterPropertiesSet() throws java.lang.Exception
org.springframework.beans.factory.InitializingBean
の afterPropertiesSet
java.lang.Exception
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
TaskExecutor
の Setter。taskExecutor
- TaskExecutor
public void setStep(Step step)
StepExecution
の実行に使用される Step
の Setter。これは通常の Spring Batch ステップであり、StepExecution
コンテキストの入力パラメーターに基づいて実行を完了するために必要なすべてのビジネスロジックが含まれています。step
- ビジネスロジックの実行に使用する Step
インスタンス public Step getStep()
StepHolder
の getStep
StepHolder.getStep()
protected java.util.Set<StepExecution> doHandle(StepExecution managerStepExecution, java.util.Set<StepExecution> partitionStepExecutions) throws java.lang.Exception
AbstractPartitionHandler
StepExecution
インスタンスを実行し、それらの更新されたビューを返します。何か問題が発生した場合は、Exception
をスローします。AbstractPartitionHandler
の doHandle
managerStepExecution
- パーティション全体の実行 partitionStepExecutions
- 実行する StepExecution
インスタンス StepExecution
インスタンスの更新されたビュー java.lang.Exception
- 何かがうまくいかない場合。これにより、実装は自由になり、必要に応じて呼び出し元が例外をステップ障害に変換することに依存することができます。protected java.util.concurrent.FutureTask<StepExecution> createTask(Step step, StepExecution stepExecution)
step
- 実行するステップ stepExecution
- 与えられた実行