public class StepListenerSupport<T,S> extends java.lang.Object implements StepExecutionListener, ChunkListener, ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListener<T,S>
StepListener interfaces.ROLLBACK_EXCEPTION_KEY| Constructor and Description |
|---|
StepListenerSupport() |
| 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 |
afterProcess(T item,
S result)
Called after
ItemProcessor.process(Object) returns. |
void |
afterRead(T item)
Called after
ItemReader.read() |
ExitStatus |
afterStep(StepExecution stepExecution)
Give a listener a chance to modify the exit status from a step.
|
void |
afterWrite(java.util.List<? extends S> items)
Called after
ItemWriter.write(java.util.List) This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext) |
void |
beforeChunk(ChunkContext context)
Callback before the chunk is executed, but inside the transaction.
|
void |
beforeProcess(T item)
Called before
ItemProcessor.process(Object). |
void |
beforeRead()
Called before
ItemReader.read() |
void |
beforeStep(StepExecution stepExecution)
Initialize the state of the listener with the
StepExecution from
the current scope. |
void |
beforeWrite(java.util.List<? extends S> items)
Called before
ItemWriter.write(java.util.List) |
void |
onProcessError(T item,
java.lang.Exception e)
Called if an exception was thrown from
ItemProcessor.process(Object). |
void |
onReadError(java.lang.Exception ex)
Called if an error occurs while trying to read.
|
void |
onSkipInProcess(T item,
java.lang.Throwable t)
This item failed on processing with the given exception, and a skip was called
for.
|
void |
onSkipInRead(java.lang.Throwable t)
Callback for a failure on read that is legal, so is not going to be
re-thrown.
|
void |
onSkipInWrite(S item,
java.lang.Throwable t)
This item failed on write with the given exception, and a skip was called
for.
|
void |
onWriteError(java.lang.Exception exception,
java.util.List<? extends S> items)
Called if an error occurs while trying to write.
|
public ExitStatus afterStep(StepExecution stepExecution)
StepExecutionListenerExitStatus.and(ExitStatus).
Called after execution of step's processing logic (both successful or
failed). Throwing exception in this method has no effect, it will only be
logged.afterStep in interface StepExecutionListenerExitStatus to combine with the normal value. Return
null to leave the old value unchanged.public void beforeStep(StepExecution stepExecution)
StepExecutionListenerStepExecution from
the current scope.beforeStep in interface StepExecutionListenerpublic void afterChunk(ChunkContext context)
ChunkListenerafterChunk in interface ChunkListenercontext - The current ChunkContextpublic void beforeChunk(ChunkContext context)
ChunkListenerbeforeChunk in interface ChunkListenercontext - The current ChunkContextpublic void afterRead(T item)
ItemReadListenerItemReader.read()afterRead in interface ItemReadListener<T>item - returned from read()public void beforeRead()
ItemReadListenerItemReader.read()beforeRead in interface ItemReadListener<T>public void onReadError(java.lang.Exception ex)
ItemReadListeneronReadError in interface ItemReadListener<T>ex - thrown from ItemWriterpublic void afterWrite(java.util.List<? extends S> items)
ItemWriteListenerItemWriter.write(java.util.List) This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext)afterWrite in interface ItemWriteListener<S>items - written itemspublic void beforeWrite(java.util.List<? extends S> items)
ItemWriteListenerItemWriter.write(java.util.List)beforeWrite in interface ItemWriteListener<S>items - to be writtenpublic void onWriteError(java.lang.Exception exception,
java.util.List<? extends S> items)
ItemWriteListeneronWriteError in interface ItemWriteListener<S>exception - thrown from ItemWriteritems - attempted to be written.public void afterProcess(T item, S result)
ItemProcessListenerItemProcessor.process(Object) returns. If the
processor returns null, this method will still be called, with
a null result, allowing for notification of 'filtered' items.afterProcess in interface ItemProcessListener<T,S>item - to be processedresult - of processingpublic void beforeProcess(T item)
ItemProcessListenerItemProcessor.process(Object).beforeProcess in interface ItemProcessListener<T,S>item - to be processed.public void onProcessError(T item, java.lang.Exception e)
ItemProcessListenerItemProcessor.process(Object).onProcessError in interface ItemProcessListener<T,S>item - attempted to be processede - - exception thrown during processing.public void onSkipInProcess(T item, java.lang.Throwable t)
SkipListeneronSkipInProcess in interface SkipListener<T,S>item - the failed itemt - the cause of the failurepublic void onSkipInRead(java.lang.Throwable t)
SkipListeneronSkipInRead in interface SkipListener<T,S>t - cause of the failurepublic void onSkipInWrite(S item, java.lang.Throwable t)
SkipListeneronSkipInWrite in interface SkipListener<T,S>item - the failed itemt - the cause of the failurepublic void afterChunkError(ChunkContext context)
ChunkListenerafterChunkError in interface ChunkListenercontext - the chunk context containing the exception that caused
the underlying rollback.