T - event implementation storing the data for sharing during exchange or parallel coordination of an event.public final class BatchEventProcessor<T> extends Object implements EventProcessor
RingBuffer
and delegating the available events to an EventHandler.
If the EventHandler also implements LifecycleAware it will be notified just after the thread
is started and just before the thread is shutdown.
| 构造器和说明 |
|---|
BatchEventProcessor(DataProvider<T> dataProvider,
SequenceBarrier sequenceBarrier,
EventHandler<? super T> eventHandler)
Construct a
EventProcessor that will automatically track the progress by updating its sequence when
the EventHandler.onEvent(Object, long, boolean) method returns. |
| 限定符和类型 | 方法和说明 |
|---|---|
Sequence |
getSequence()
Get a reference to the
Sequence being used by this EventProcessor. |
void |
halt()
Signal that this EventProcessor should stop when it has finished consuming at the next clean break.
|
boolean |
isRunning() |
void |
run()
It is ok to have another thread rerun this method after a halt().
|
void |
setExceptionHandler(ExceptionHandler<? super T> exceptionHandler)
Set a new
ExceptionHandler for handling exceptions propagated out of the BatchEventProcessor |
public BatchEventProcessor(DataProvider<T> dataProvider, SequenceBarrier sequenceBarrier, EventHandler<? super T> eventHandler)
EventProcessor that will automatically track the progress by updating its sequence when
the EventHandler.onEvent(Object, long, boolean) method returns.dataProvider - to which events are published.sequenceBarrier - on which it is waiting.eventHandler - is the delegate to which events are dispatched.public Sequence getSequence()
EventProcessorSequence being used by this EventProcessor.getSequence 在接口中 EventProcessorSequence for this EventProcessorpublic void halt()
EventProcessorSequenceBarrier.alert() to notify the thread to check status.halt 在接口中 EventProcessorpublic boolean isRunning()
isRunning 在接口中 EventProcessorpublic void setExceptionHandler(ExceptionHandler<? super T> exceptionHandler)
ExceptionHandler for handling exceptions propagated out of the BatchEventProcessorexceptionHandler - to replace the existing exceptionHandler.public void run()
run 在接口中 RunnableIllegalStateException - if this object instance is already running in a threadCopyright © 2018 Pivotal Software, Inc.. All rights reserved.