类 MulticasterBatchListener<T,S>
- java.lang.Object
- org.springframework.batch.core.listener.MulticasterBatchListener<T,S>
- 所有已实现的接口:
javax.batch.api.chunk.listener.RetryProcessListener
,javax.batch.api.chunk.listener.RetryReadListener
,javax.batch.api.chunk.listener.RetryWriteListener
,ChunkListener
,ItemProcessListener<T,S>
,ItemReadListener<T>
,ItemWriteListener<S>
,SkipListener<T,S>
,StepExecutionListener
,StepListener
public class MulticasterBatchListener<T,S> extends java.lang.Object implements StepExecutionListener, ChunkListener, ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListener<T,S>, javax.batch.api.chunk.listener.RetryReadListener, javax.batch.api.chunk.listener.RetryProcessListener, javax.batch.api.chunk.listener.RetryWriteListener
- 作者:
- Dave Syer, Michael Minella, Chris Schaefer, Mahmoud Ben Hassine
字段概要
从接口继承的字段 org.springframework.batch.core.ChunkListener
ROLLBACK_EXCEPTION_KEY
构造器概要
构造器 构造器 说明 MulticasterBatchListener()
Initialize the listener instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 afterItemProcessor.process(Object)
returns.void
afterRead(T item)
Called afterItemReader.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 afterItemWriter.write(java.util.List)
This will be called before any transaction is committed, and beforeChunkListener.afterChunk(ChunkContext)
void
beforeChunk(ChunkContext context)
Callback before the chunk is executed, but inside the transaction.void
beforeProcess(T item)
Called beforeItemProcessor.process(Object)
.void
beforeRead()
Called beforeItemReader.read()
void
beforeStep(StepExecution stepExecution)
Initialize the state of the listener with theStepExecution
from the current scope.void
beforeWrite(java.util.List<? extends S> items)
Called beforeItemWriter.write(java.util.List)
void
onProcessError(T item, java.lang.Exception ex)
Called if an exception was thrown fromItemProcessor.process(Object)
.void
onReadError(java.lang.Exception ex)
Called if an error occurs while trying to read.void
onRetryProcessException(java.lang.Object item, java.lang.Exception ex)
void
onRetryReadException(java.lang.Exception ex)
void
onRetryWriteException(java.util.List<java.lang.Object> items, java.lang.Exception ex)
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 ex, java.util.List<? extends S> items)
Called if an error occurs while trying to write.void
register(StepListener listener)
Register the listener for callbacks on the appropriate interfaces implemented.void
setListeners(java.util.List<? extends StepListener> listeners)
Register each of the objects as listeners.
构造器详细资料
MulticasterBatchListener
public MulticasterBatchListener()
Initialize the listener instance.
方法详细资料
setListeners
public void setListeners(java.util.List<? extends StepListener> listeners)
Register each of the objects as listeners. Once registered, calls to theMulticasterBatchListener
broadcast to the individual listeners.- 参数:
listeners
- listener objects of types known to the multicaster.
register
public void register(StepListener listener)
Register the listener for callbacks on the appropriate interfaces implemented. AnyStepListener
can be provided, or anItemStream
. Other types will be ignored.- 参数:
listener
- theStepListener
instance to be registered.
afterProcess
public void afterProcess(T item, @Nullable S result)
从接口复制的说明:ItemProcessListener
Called afterItemProcessor.process(Object)
returns. If the processor returnsnull
, this method will still be called, with a {code null} result, allowing for notification of 'filtered' items.- 指定者:
afterProcess
在接口中ItemProcessListener<T,S>
- 参数:
item
- to be processedresult
- of processing- 另请参阅:
CompositeItemProcessListener.afterProcess(java.lang.Object, java.lang.Object)
beforeProcess
public void beforeProcess(T item)
从接口复制的说明:ItemProcessListener
Called beforeItemProcessor.process(Object)
.- 指定者:
beforeProcess
在接口中ItemProcessListener<T,S>
- 参数:
item
- to be processed.- 另请参阅:
CompositeItemProcessListener.beforeProcess(java.lang.Object)
onProcessError
public void onProcessError(T item, java.lang.Exception ex)
从接口复制的说明:ItemProcessListener
Called if an exception was thrown fromItemProcessor.process(Object)
.- 指定者:
onProcessError
在接口中ItemProcessListener<T,S>
- 参数:
item
- attempted to be processedex
- - exception thrown during processing.- 另请参阅:
CompositeItemProcessListener.onProcessError(java.lang.Object, java.lang.Exception)
afterStep
public ExitStatus afterStep(StepExecution stepExecution)
从接口复制的说明:StepExecutionListener
Give a listener a chance to modify the exit status from a step. The value returned will be combined with the normal exit status usingExitStatus.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
在接口中StepExecutionListener
- 参数:
stepExecution
-StepExecution
instance.- 返回:
- an
ExitStatus
to combine with the normal value. Returnnull
to leave the old value unchanged. - 另请参阅:
CompositeStepExecutionListener.afterStep(StepExecution)
beforeStep
public void beforeStep(StepExecution stepExecution)
从接口复制的说明:StepExecutionListener
Initialize the state of the listener with theStepExecution
from the current scope.- 指定者:
beforeStep
在接口中StepExecutionListener
- 参数:
stepExecution
- instance ofStepExecution
.- 另请参阅:
CompositeStepExecutionListener.beforeStep(org.springframework.batch.core.StepExecution)
afterChunk
public void afterChunk(ChunkContext context)
从接口复制的说明:ChunkListener
Callback after the chunk is executed, outside the transaction.- 指定者:
afterChunk
在接口中ChunkListener
- 参数:
context
- The currentChunkContext
- 另请参阅:
CompositeChunkListener.afterChunk(ChunkContext context)
beforeChunk
public void beforeChunk(ChunkContext context)
从接口复制的说明:ChunkListener
Callback before the chunk is executed, but inside the transaction.- 指定者:
beforeChunk
在接口中ChunkListener
- 参数:
context
- The currentChunkContext
- 另请参阅:
CompositeChunkListener.beforeChunk(ChunkContext context)
afterRead
public void afterRead(T item)
从接口复制的说明:ItemReadListener
Called afterItemReader.read()
. This method is called only for actual items (ie it is not called when the reader returns null).- 指定者:
afterRead
在接口中ItemReadListener<T>
- 参数:
item
- returned from read()- 另请参阅:
CompositeItemReadListener.afterRead(java.lang.Object)
beforeRead
public void beforeRead()
从接口复制的说明:ItemReadListener
Called beforeItemReader.read()
- 指定者:
beforeRead
在接口中ItemReadListener<T>
- 另请参阅:
CompositeItemReadListener.beforeRead()
onReadError
public void onReadError(java.lang.Exception ex)
从接口复制的说明:ItemReadListener
Called if an error occurs while trying to read.- 指定者:
onReadError
在接口中ItemReadListener<T>
- 参数:
ex
- thrown fromItemWriter
- 另请参阅:
CompositeItemReadListener.onReadError(java.lang.Exception)
afterWrite
public void afterWrite(java.util.List<? extends S> items)
从接口复制的说明:ItemWriteListener
Called afterItemWriter.write(java.util.List)
This will be called before any transaction is committed, and beforeChunkListener.afterChunk(ChunkContext)
- 指定者:
afterWrite
在接口中ItemWriteListener<T>
- 参数:
items
- written items- 另请参阅:
ItemWriteListener.afterWrite(List)
beforeWrite
public void beforeWrite(java.util.List<? extends S> items)
从接口复制的说明:ItemWriteListener
Called beforeItemWriter.write(java.util.List)
- 指定者:
beforeWrite
在接口中ItemWriteListener<T>
- 参数:
items
- to be written- 另请参阅:
ItemWriteListener.beforeWrite(List)
onWriteError
public void onWriteError(java.lang.Exception ex, java.util.List<? extends S> items)
从接口复制的说明:ItemWriteListener
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.- 指定者:
onWriteError
在接口中ItemWriteListener<T>
- 参数:
ex
- thrown fromItemWriter
items
- attempted to be written.- 另请参阅:
ItemWriteListener.onWriteError(Exception, List)
onSkipInRead
public void onSkipInRead(java.lang.Throwable t)
从接口复制的说明:SkipListener
Callback for a failure on read that is legal, so is not going to be re-thrown. In case transaction is rolled back and items are re-read, this callback will occur repeatedly for the same cause. This will only happen if read items are not buffered.- 指定者:
onSkipInRead
在接口中SkipListener<T,S>
- 参数:
t
- cause of the failure- 另请参阅:
CompositeSkipListener.onSkipInRead(java.lang.Throwable)
onSkipInWrite
public void onSkipInWrite(S item, java.lang.Throwable t)
从接口复制的说明:SkipListener
This item failed on write with the given exception, and a skip was called for.- 指定者:
onSkipInWrite
在接口中SkipListener<T,S>
- 参数:
item
- the failed itemt
- the cause of the failure- 另请参阅:
CompositeSkipListener.onSkipInWrite(java.lang.Object, java.lang.Throwable)
onSkipInProcess
public void onSkipInProcess(T item, java.lang.Throwable t)
从接口复制的说明:SkipListener
This item failed on processing with the given exception, and a skip was called for.- 指定者:
onSkipInProcess
在接口中SkipListener<T,S>
- 参数:
item
- the failed itemt
- the cause of the failure- 另请参阅:
CompositeSkipListener.onSkipInProcess(Object, Throwable)
afterChunkError
public void afterChunkError(ChunkContext context)
从接口复制的说明: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.- 指定者:
afterChunkError
在接口中ChunkListener
- 参数:
context
- the chunk context containing the exception that caused the underlying rollback.
onRetryReadException
public void onRetryReadException(java.lang.Exception ex) throws java.lang.Exception
- 指定者:
onRetryReadException
在接口中javax.batch.api.chunk.listener.RetryReadListener
- 抛出:
java.lang.Exception
onRetryProcessException
public void onRetryProcessException(java.lang.Object item, java.lang.Exception ex) throws java.lang.Exception
- 指定者:
onRetryProcessException
在接口中javax.batch.api.chunk.listener.RetryProcessListener
- 抛出:
java.lang.Exception
onRetryWriteException
public void onRetryWriteException(java.util.List<java.lang.Object> items, java.lang.Exception ex) throws java.lang.Exception
- 指定者:
onRetryWriteException
在接口中javax.batch.api.chunk.listener.RetryWriteListener
- 抛出:
java.lang.Exception