org.springframework.batch.core.listener

## Class CompositeChunkListener

- java.lang.Object
- - org.springframework.batch.core.listener.CompositeChunkListener

- All Implemented Interfaces:
    ChunkListener, StepListener

      public class CompositeChunkListener
      extends java.lang.Object
      implements ChunkListener

  Author:
    Lucas Ward

- - ### Field Summary

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

      `ROLLBACK_EXCEPTION_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeChunkListener()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterChunk(ChunkContext context)` Call the registered listeners in order, respecting and prioritizing those that implement `Ordered`.
    `void` | `afterChunkError(ChunkContext context)` Callback after a chunk has been marked for rollback.
    `void` | `beforeChunk(ChunkContext context)` Call the registered listeners in reverse order.
    `void` | `register(ChunkListener chunkListener)` Register additional listener.
    `void` | `setListeners(java.util.List<? extends ChunkListener> listeners)` Public setter for the listeners.

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

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

- - ### Constructor Detail

    - #### CompositeChunkListener

          public CompositeChunkListener()

  - ### Method Detail

    - #### setListeners

          public void setListeners(java.util.List<? extends ChunkListener> listeners)

      Public setter for the listeners.
      Parameters:
        `listeners` -

    - #### register

          public void register(ChunkListener chunkListener)

      Register additional listener.
      Parameters:
        `chunkListener` -

    - #### afterChunk

          public void afterChunk(ChunkContext context)

      Call the registered listeners in order, respecting and prioritizing those that implement `Ordered`.
      Specified by:
        `afterChunk` in interface `ChunkListener`
      Parameters:
        `context` - The current `ChunkContext`
      See Also:
        `ChunkListener.afterChunk(ChunkContext context)`

    - #### beforeChunk

          public void beforeChunk(ChunkContext context)

      Call the registered listeners in reverse order.
      Specified by:
        `beforeChunk` in interface `ChunkListener`
      Parameters:
        `context` - The current `ChunkContext`
      See Also:
        `ChunkListener.beforeChunk(ChunkContext context)`

    - #### 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 run 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.