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.
    • Constructor Detail

    • 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.
      • setRewindStrategy

        public void setRewindStrategy​(BatchRewindStrategy batchRewindStrategy)
        Set a new BatchRewindStrategy for customizing how to handle a RewindableException Which can include whether the batch should be rewound and reattempted, or simply thrown and move on to the next sequence the default is a SimpleBatchRewindStrategy which always rewinds
        Parameters:
        batchRewindStrategy - to replace the existing rewindStrategy.
      • 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