@@ -103,33 +103,31 @@ The annotations corresponding to this interface are:
103103A "`chunk`" is defined as the items processed within the scope of a transaction. Committing a
104104transaction, at each commit interval, commits a chunk. You can use a `ChunkListener` to
105105perform logic before a chunk begins processing or after a chunk has completed
106- successfully, as the following interface definition shows:
106+ successfully or in failure , as the following interface definition shows:
107107
108108[source, java]
109109----
110- public interface ChunkListener extends StepListener {
110+ public interface ChunkListener<I, O> extends StepListener {
111111
112- void beforeChunk(ChunkContext context );
113- void afterChunk(ChunkContext context );
114- void afterChunkError(ChunkContext context );
112+ void beforeChunk(Chunk<I> chunk );
113+ void afterChunk(Chunk<O> chunk );
114+ void afterChunkError(Exception exception, Chunk<O> chunk );
115115
116116}
117117----
118118
119- The beforeChunk method is called after the transaction is started but before reading begins
120- on the `ItemReader`. Conversely, `afterChunk` is called after the chunk has been
121- committed (or not at all if there is a rollback).
119+ The `beforeChunk` method is called after the transaction is started after reading a chunk
120+ of items but before processing start. Conversely, `afterChunk` is called after the chunk
121+ is written but before the transaction is committed or rolled back.
122+
123+ NOTE: The `ChunkListener` listener interface is not called in concurrent steps
122124
123125The annotations corresponding to this interface are:
124126
125127* `@BeforeChunk`
126128* `@AfterChunk`
127129* `@AfterChunkError`
128130
129- You can apply a `ChunkListener` when there is no chunk declaration. The `TaskletStep` is
130- responsible for calling the `ChunkListener`, so it applies to a non-item-oriented tasklet
131- as well (it is called before and after the tasklet).
132-
133131A `ChunkListener` is not designed to throw checked exceptions. Errors must be handled in the
134132implementation or the step will terminate.
135133
0 commit comments