Class MonitorBatchEventProcessor<T>
- java.lang.Object
-
- org.epics.ca.impl.monitor.disruptor.MonitorBatchEventProcessor<T>
-
- Type Parameters:
T- event implementation storing the data for sharing during exchange or parallel coordination of an event.
- All Implemented Interfaces:
com.lmax.disruptor.EventProcessor,java.lang.Runnable
public final class MonitorBatchEventProcessor<T> extends java.lang.Object implements com.lmax.disruptor.EventProcessorThis is a modification ofBatchEventProcessorthat reports monitor connection loss events.Convenience class for handling the batching semantics of consuming entries from a
RingBufferand delegating the available events to anEventHandler.If the
EventHandleralso implementsLifecycleAwareit will be notified just after the thread is started and just before the thread is shutdown.
-
-
Constructor Summary
Constructors Constructor 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 aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.lmax.disruptor.SequencegetSequence()voidhalt()booleanisRunning()voidrun()It is ok to have another thread rerun this method after a halt().voidsetExceptionHandler(com.lmax.disruptor.ExceptionHandler<? super T> exceptionHandler)Set a newExceptionHandlerfor handling exceptions propagated out of theMonitorBatchEventProcessor
-
-
-
Constructor Detail
-
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)
Construct aEventProcessorthat will automatically track the progress by updating its sequence when theEventHandler.onEvent(Object, long, boolean)method returns.- Parameters:
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.
-
-
Method Detail
-
getSequence
public com.lmax.disruptor.Sequence getSequence()
- Specified by:
getSequencein interfacecom.lmax.disruptor.EventProcessor
-
halt
public void halt()
- Specified by:
haltin interfacecom.lmax.disruptor.EventProcessor
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfacecom.lmax.disruptor.EventProcessor
-
setExceptionHandler
public void setExceptionHandler(com.lmax.disruptor.ExceptionHandler<? super T> exceptionHandler)
Set a newExceptionHandlerfor handling exceptions propagated out of theMonitorBatchEventProcessor- Parameters:
exceptionHandler- to replace the existing exceptionHandler.
-
run
public void run()
It is ok to have another thread rerun this method after a halt().- Specified by:
runin interfacejava.lang.Runnable- Throws:
java.lang.IllegalStateException- if this object instance is already running in a thread
-
-