|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.lmax.disruptor.BatchEventProcessor<T>
T - event implementation storing the data for sharing during exchange or parallel coordination of an event.public final class BatchEventProcessor<T>
Convenience class for handling the batching semantics of consuming entries from a RingBuffer
and delegating the available events to a EventHandler.
If the EventHandler also implements LifecycleAware it will be notified just after the thread
is started and just before the thread is shutdown.
| Constructor Summary | |
|---|---|
BatchEventProcessor(RingBuffer<T> ringBuffer,
SequenceBarrier sequenceBarrier,
EventHandler<T> eventHandler)
Construct a EventProcessor that will automatically track the progress by updating its sequence when
the EventHandler.onEvent(Object, long, boolean) method returns. |
|
| Method Summary | |
|---|---|
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. |
void |
run()
It is ok to have another thread rerun this method after a halt(). |
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Set a new ExceptionHandler for handling exceptions propagated out of the BatchEventProcessor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BatchEventProcessor(RingBuffer<T> ringBuffer,
SequenceBarrier sequenceBarrier,
EventHandler<T> eventHandler)
EventProcessor that will automatically track the progress by updating its sequence when
the EventHandler.onEvent(Object, long, boolean) method returns.
ringBuffer - to which events are published.sequenceBarrier - on which it is waiting.eventHandler - is the delegate to which events are dispatched.| Method Detail |
|---|
public Sequence getSequence()
EventProcessorSequence being used by this EventProcessor.
getSequence in interface EventProcessorSequence for this EventProcessorpublic void halt()
EventProcessorSequenceBarrier.alert() to notify the thread to check status.
halt in interface EventProcessorpublic void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler for handling exceptions propagated out of the BatchEventProcessor
exceptionHandler - to replace the existing exceptionHandler.public void run()
run in interface java.lang.Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||