Package com.lmax.disruptor
Interface SequenceReportingEventHandler<T>
-
- Type Parameters:
T- event implementation storing the data for sharing during exchange or parallel coordination of an event.
- All Superinterfaces:
EventHandler<T>,EventHandlerIdentity
public interface SequenceReportingEventHandler<T> extends EventHandler<T>
Used by theBatchEventProcessorto set a callback allowing theEventHandlerto notify when it has finished consuming an event if this happens after theEventHandler.onEvent(Object, long, boolean)call.Typically this would be used when the handler is performing some sort of batching operation such as writing to an IO device; after the operation has completed, the implementation should call
Sequence.set(long)to update the sequence and allow other processes that are dependent on this handler to progress.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidonBatchStart(long batchSize, long queueDepth)Invoked byBatchEventProcessorprior to processing a batch of eventsdefault voidonShutdown()Called once just before the event processing thread is shutdown.default voidonStart()Called once on thread start before first event is available.default voidonTimeout(long sequence)voidsetSequenceCallback(Sequence sequenceCallback)Call by theBatchEventProcessorto setup the callback.-
Methods inherited from interface com.lmax.disruptor.EventHandler
onEvent
-
-
-
-
Method Detail
-
setSequenceCallback
void setSequenceCallback(Sequence sequenceCallback)
Call by theBatchEventProcessorto setup the callback.- Specified by:
setSequenceCallbackin interfaceEventHandler<T>- Parameters:
sequenceCallback- callback on which to notify theBatchEventProcessorthat the sequence has progressed.
-
onBatchStart
default void onBatchStart(long batchSize, long queueDepth)Invoked byBatchEventProcessorprior to processing a batch of events- Parameters:
batchSize- the size of the batch that is startingqueueDepth- the total number of queued up events including the batch about to be processed
-
onStart
default void onStart()
Called once on thread start before first event is available.
-
onShutdown
default void onShutdown()
Called once just before the event processing thread is shutdown.Sequence event processing will already have stopped before this method is called. No events will be processed after this message.
-
onTimeout
default void onTimeout(long sequence) throws java.lang.Exception- Parameters:
sequence- - the last processed sequence.- Throws:
java.lang.Exception- if the implementation is unable to handle this timeout.
-
-