org.springframework.batch.core.jsr

## Class ChunkListenerAdapter

- java.lang.Object
- - org.springframework.batch.core.jsr.ChunkListenerAdapter

- All Implemented Interfaces:
    ChunkListener, StepListener

      public class ChunkListenerAdapter
      extends java.lang.Object
      implements ChunkListener

  Wrapper class to adapt the `ChunkListener` to a `ChunkListener`.
  Since:
    3.0
  Author:
    Michael Minella

- - ### Field Summary

    - ### Fields inherited from interface org.springframework.batch.core.ChunkListener

      `ROLLBACK_EXCEPTION_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChunkListenerAdapter(javax.batch.api.chunk.listener.ChunkListener delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterChunk(ChunkContext context)` Callback after the chunk is executed, outside the transaction.
    `void` | `afterChunkError(ChunkContext context)` Callback after a chunk has been marked for rollback.
    `void` | `beforeChunk(ChunkContext context)` Callback before the chunk is executed, but inside the transaction.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ChunkListenerAdapter

          public ChunkListenerAdapter(javax.batch.api.chunk.listener.ChunkListener delegate)

      Parameters:
        `delegate` - to be called within the step chunk lifecycle

  - ### Method Detail

    - #### beforeChunk

          public void beforeChunk(ChunkContext context)

      Description copied from interface: `ChunkListener`
      Callback before the chunk is executed, but inside the transaction.
      Specified by:
        `beforeChunk` in interface `ChunkListener`
      Parameters:
        `context` - The current `ChunkContext`

    - #### afterChunk

          public void afterChunk(ChunkContext context)

      Description copied from interface: `ChunkListener`
      Callback after the chunk is executed, outside the transaction.
      Specified by:
        `afterChunk` in interface `ChunkListener`
      Parameters:
        `context` - The current `ChunkContext`

    - #### afterChunkError

          public void afterChunkError(ChunkContext context)

      Description copied from interface: `ChunkListener`
      Callback after a chunk has been marked for rollback. It is invoked after transaction rollback. While the rollback will have occurred, transactional resources might still be active and accessible. Due to this, data access code within this callback will still "participate" in the original transaction unless it declares that it runs in its own transaction. Hence: Use PROPAGATION_REQUIRES_NEW for any transactional operation that is called from here.
      Specified by:
        `afterChunkError` in interface `ChunkListener`
      Parameters:
        `context` - the chunk context containing the exception that caused the underlying rollback.