Class BatchEventProcessor<T>

  • Type Parameters:
    T - event implementation storing the data for sharing during exchange or parallel coordination of an event.
    All Implemented Interfaces:
    EventProcessor, java.lang.Runnable

    public final class BatchEventProcessor<T>
    extends java.lang.Object
    implements EventProcessor
    Convenience class for handling the batching semantics of consuming entries from a RingBuffer and delegating the available events to an EventHandler.
    • Method Detail

      • halt

        public void halt()
        Description copied from interface: EventProcessor
        Signal that this EventProcessor should stop when it has finished consuming at the next clean break. It will call SequenceBarrier.alert() to notify the thread to check status.
        Specified by:
        halt in interface EventProcessor
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface EventProcessor
        Returns:
        whether this event processor is running or not Implementations should ideally return false only when the associated thread is idle.
      • setExceptionHandler

        public void setExceptionHandler​(ExceptionHandler<? super T> exceptionHandler)
        Set a new ExceptionHandler for handling exceptions propagated out of the BatchEventProcessor.
        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:
        run in interface java.lang.Runnable
        Throws:
        java.lang.IllegalStateException - if this object instance is already running in a thread