接口 ItemWriteListener<S>
- 所有超级接口:
StepListener
- 所有已知实现类:
CompositeItemWriteListener
,DefaultItemFailureHandler
,ItemListenerSupport
,ItemWriteListenerAdapter
,MulticasterBatchListener
,StagingItemListener
,StepListenerSupport
public interface ItemWriteListener<S> extends StepListener
Listener interface for the writing of items. Implementations of this interface will be notified before, after, and in case of any exception thrown while writing a list of items.
Note: This listener is designed to work around the lifecycle of an item. This means that each method should be called once within the lifecycle of an item and in fault tolerant scenarios, any transactional work that is done in one of these methods would be rolled back and not re-applied. Because of this, it is recommended to not perform any logic using this listener that participates in a transaction.
- 作者:
- Lucas Ward
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
afterWrite(java.util.List<? extends S> items)
Called afterItemWriter.write(java.util.List)
This will be called before any transaction is committed, and beforeChunkListener.afterChunk(ChunkContext)
void
beforeWrite(java.util.List<? extends S> items)
Called beforeItemWriter.write(java.util.List)
void
onWriteError(java.lang.Exception exception, java.util.List<? extends S> items)
Called if an error occurs while trying to write.
方法详细资料
beforeWrite
void beforeWrite(java.util.List<? extends S> items)
Called beforeItemWriter.write(java.util.List)
- 参数:
items
- to be written
afterWrite
void afterWrite(java.util.List<? extends S> items)
Called afterItemWriter.write(java.util.List)
This will be called before any transaction is committed, and beforeChunkListener.afterChunk(ChunkContext)
- 参数:
items
- written items
onWriteError
void onWriteError(java.lang.Exception exception, java.util.List<? extends S> items)
Called if an error occurs while trying to write. Will be called inside a transaction, but the transaction will normally be rolled back. There is no way to identify from this callback which of the items (if any) caused the error.- 参数:
exception
- thrown fromItemWriter
items
- attempted to be written.