class CompositeChunkListener implements ChunkListener {

	private final OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();

	/**
	 * Default constructor
	 */
	public CompositeChunkListener() {

	}

	/**
	 * Convenience constructor for setting the {@link ChunkListener}s.
	 * @param listeners list of {@link ChunkListener}.
	 */
	public CompositeChunkListener(List<? extends ChunkListener> listeners) {
		setListeners(listeners);
	}

	/**
	 * Convenience constructor for setting the {@link ChunkListener}s.
	 * @param listeners array of {@link ChunkListener}.
	 */
	public CompositeChunkListener(ChunkListener... listeners) {
		this(Arrays.asList(listeners));
	}

	/**
	 * Public setter for the listeners.
	 * @param listeners list of {@link ChunkListener}.
	 */
	public void setListeners(List<? extends ChunkListener> listeners) {
		this.listeners.setItems(listeners);
	}

	/**
	 * Register additional listener.
	 * @param chunkListener instance of {@link ChunkListener}.
	 */
	public void register(ChunkListener chunkListener) {
		listeners.add(chunkListener);
	}

	/**
	 * Call the registered listeners in reverse order.
	 *
	 * @see org.springframework.batch.core.ChunkListener#afterChunk(ChunkContext context)
	 */
	@Override
	public void afterChunk(ChunkContext context) {<FILL_FUNCTION_BODY>}

	/**
	 * Call the registered listeners in order, respecting and prioritizing those that
	 * implement {@link Ordered}.
	 *
	 * @see org.springframework.batch.core.ChunkListener#beforeChunk(ChunkContext context)
	 */
	@Override
	public void beforeChunk(ChunkContext context) {
		for (Iterator<ChunkListener> iterator = listeners.iterator(); iterator.hasNext();) {
			ChunkListener listener = iterator.next();
			listener.beforeChunk(context);
		}
	}

	/**
	 * Call the registered listeners in reverse order.
	 *
	 * @see org.springframework.batch.core.ChunkListener#afterChunkError(ChunkContext
	 * context)
	 */
	@Override
	public void afterChunkError(ChunkContext context) {
		for (Iterator<ChunkListener> iterator = listeners.reverse(); iterator.hasNext();) {
			ChunkListener listener = iterator.next();
			listener.afterChunkError(context);
		}
	}

}

		for (Iterator<ChunkListener> iterator = listeners.reverse(); iterator.hasNext();) {
			ChunkListener listener = iterator.next();
			listener.afterChunk(context);
		}
	
<no_super_class>