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.void
beforeStep
(StepExecution stepExecution) Initialize the state of the listener with theStepExecution
from the current scope.void
Process 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:ItemWriter
Process the supplied data element. Will not be called with any null items in normal operation.- Specified by:
write
in interfaceItemWriter<T>
- Parameters:
chunk
- of items to be written. Must not benull
.
-
beforeStep
Description copied from interface:StepExecutionListener
Initialize the state of the listener with theStepExecution
from the current scope.- Specified by:
beforeStep
in interfaceStepExecutionListener
- Parameters:
stepExecution
- instance ofStepExecution
.
-
afterStep
Description copied from interface:StepExecutionListener
Give 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:
afterStep
in interfaceStepExecutionListener
- Parameters:
stepExecution
- aStepExecution
instance.- Returns:
- an
ExitStatus
to combine with the normal value. Returnnull
(the default) to leave the old value unchanged.
-