T - event implementation storing the data for sharing during exchange or parallel coordination of an event.public final class MonitorBatchEventProcessor<T>
extends java.lang.Object
implements com.lmax.disruptor.EventProcessor
BatchEventProcessor that reports monitor connection loss events.
Convenience class for handling the batching semantics of consuming entries from a 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.
| Constructor and Description |
|---|
MonitorBatchEventProcessor(ConnectionInterruptable channel,
T disconnectedValue,
java.util.function.Predicate<T> isDisconnectedValue,
com.lmax.disruptor.DataProvider<T> dataProvider,
com.lmax.disruptor.SequenceBarrier sequenceBarrier,
com.lmax.disruptor.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. |
| Modifier and Type | Method and Description |
|---|---|
com.lmax.disruptor.Sequence |
getSequence() |
void |
halt() |
boolean |
isRunning() |
void |
run()
It is ok to have another thread rerun this method after a halt().
|
void |
setExceptionHandler(com.lmax.disruptor.ExceptionHandler<? super T> exceptionHandler)
Set a new
ExceptionHandler for handling exceptions propagated out of the MonitorBatchEventProcessor |
public MonitorBatchEventProcessor(ConnectionInterruptable channel, T disconnectedValue, java.util.function.Predicate<T> isDisconnectedValue, com.lmax.disruptor.DataProvider<T> dataProvider, com.lmax.disruptor.SequenceBarrier sequenceBarrier, com.lmax.disruptor.EventHandler<? super T> eventHandler)
EventProcessor that will automatically track the progress by updating its sequence when
the EventHandler.onEvent(Object, long, boolean) method returns.channel - reference to an object which can report on the state of the connection.disconnectedValue - the value to be published to indicate channel disconnection.isDisconnectedValue - predicate which returns true when the channel is disconnected.dataProvider - to which events are published.sequenceBarrier - on which it is waiting.eventHandler - is the delegate to which events are dispatched.public com.lmax.disruptor.Sequence getSequence()
getSequence in interface com.lmax.disruptor.EventProcessorpublic void halt()
halt in interface com.lmax.disruptor.EventProcessorpublic boolean isRunning()
isRunning in interface com.lmax.disruptor.EventProcessorpublic void setExceptionHandler(com.lmax.disruptor.ExceptionHandler<? super T> exceptionHandler)
ExceptionHandler for handling exceptions propagated out of the MonitorBatchEventProcessorexceptionHandler - to replace the existing exceptionHandler.public void run()
run in interface java.lang.Runnablejava.lang.IllegalStateException - if this object instance is already running in a thread