Package com.lmax.disruptor
Class AggregateEventHandler<T>
java.lang.Object
com.lmax.disruptor.AggregateEventHandler<T>
- Type Parameters:
T- event implementation storing the data for sharing during exchange or parallel coordination of an event.
- All Implemented Interfaces:
EventHandler<T>,EventHandlerBase<T>,EventHandlerIdentity
An aggregate collection of
EventHandlers that get called in sequence for each event.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAggregateEventHandler(EventHandler<T>... eventHandlers) Construct an aggregate collection ofEventHandlers to be called in sequence. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when a publisher has published an event to theRingBuffer.voidCalled once just before the event processing thread is shutdown.voidonStart()Called once on thread start before first event is available.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.lmax.disruptor.EventHandler
setSequenceCallbackMethods inherited from interface com.lmax.disruptor.EventHandlerBase
onBatchStart, onTimeout
-
Field Details
-
eventHandlers
-
-
Constructor Details
-
AggregateEventHandler
Construct an aggregate collection ofEventHandlers to be called in sequence.- Parameters:
eventHandlers- to be called in sequence.
-
-
Method Details
-
onEvent
Description copied from interface:EventHandlerCalled when a publisher has published an event to theRingBuffer. TheBatchEventProcessorwill read messages from theRingBufferin batches, where a batch is all of the events available to be processed without having to wait for any new event to arrive. This can be useful for event handlers that need to do slower operations like I/O as they can group together the data from multiple events into a single operation. Implementations should ensure that the operation is always performed when endOfBatch is true as the time between that message and the next one is indeterminate.- Specified by:
onEventin interfaceEventHandler<T>- Specified by:
onEventin interfaceEventHandlerBase<T>- Parameters:
event- published to theRingBuffersequence- of the event being processedendOfBatch- flag to indicate if this is the last event in a batch from theRingBuffer- Throws:
Exception- if the EventHandler would like the exception handled further up the chain.
-
onStart
public void onStart()Description copied from interface:EventHandlerBaseCalled once on thread start before first event is available.- Specified by:
onStartin interfaceEventHandlerBase<T>
-
onShutdown
public void onShutdown()Description copied from interface:EventHandlerBaseCalled 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.
- Specified by:
onShutdownin interfaceEventHandlerBase<T>
-