Class ChunkTaskExecutorItemWriter<T>
java.lang.Object
org.springframework.batch.integration.chunk.ChunkTaskExecutorItemWriter<T>
- Type Parameters:
T- type of items
- All Implemented Interfaces:
StepExecutionListener,StepListener,ItemWriter<T>
public class ChunkTaskExecutorItemWriter<T>
extends Object
implements ItemWriter<T>, StepExecutionListener
Similar to
ChunkMessageChannelItemWriter, this item writer submits chunk
requests to local workers from a TaskExecutor instead of sending them over a
message channel to remote workers.- Since:
- 6.0
- Author:
- Mahmoud Ben Hassine
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChunkTaskExecutorItemWriter(ChunkProcessor<T> chunkRequestProcessor, org.springframework.core.task.TaskExecutor taskExecutor) Create a newChunkTaskExecutorItemWriter. -
Method Summary
Modifier and TypeMethodDescriptionafterStep(StepExecution stepExecution) Give a listener a chance to modify the exit status from a step.voidbeforeStep(StepExecution stepExecution) Initialize the state of the listener with theStepExecutionfrom the current scope.voidProcess the supplied data element.
-
Constructor Details
-
ChunkTaskExecutorItemWriter
public ChunkTaskExecutorItemWriter(ChunkProcessor<T> chunkRequestProcessor, org.springframework.core.task.TaskExecutor taskExecutor) Create a newChunkTaskExecutorItemWriter.- Parameters:
chunkRequestProcessor- the chunk processor to process chunkstaskExecutor- the task executor to submit chunk processing tasks to
-
-
Method Details
-
write
Description copied from interface:ItemWriterProcess the supplied data element. Will not be called with any null items in normal operation.- Specified by:
writein interfaceItemWriter<T>- Parameters:
chunk- of items to be written. Must not benull.
-
beforeStep
Description copied from interface:StepExecutionListenerInitialize the state of the listener with theStepExecutionfrom the current scope.- Specified by:
beforeStepin interfaceStepExecutionListener- Parameters:
stepExecution- instance ofStepExecution.
-
afterStep
Description copied from interface:StepExecutionListenerGive a listener a chance to modify the exit status from a step. The value returned is combined with the normal exit status by usingExitStatus.and(ExitStatus).Called after execution of the step's processing logic (whether successful or failed). Throwing an exception in this method has no effect, as it is only logged.
- Specified by:
afterStepin interfaceStepExecutionListener- Parameters:
stepExecution- aStepExecutioninstance.- Returns:
- an
ExitStatusto combine with the normal value. Returnnull(the default) to leave the old value unchanged.
-