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>
,LifecycleAware
public final class AggregateEventHandler<T> extends Object implements EventHandler<T>, LifecycleAware
An aggregate collection ofEventHandler
s that get called in sequence for each event.
-
-
Constructor Summary
Constructors Constructor Description AggregateEventHandler(EventHandler<T>... eventHandlers)
Construct an aggregate collection ofEventHandler
s to be called in sequence.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onEvent(T event, long sequence, boolean endOfBatch)
Called when a publisher has published an event to theRingBuffer
void
onShutdown()
Called once just before the thread is shutdown.void
onStart()
Called once on thread start before first event is available.
-
-
-
Constructor Detail
-
AggregateEventHandler
public AggregateEventHandler(EventHandler<T>... eventHandlers)
Construct an aggregate collection ofEventHandler
s to be called in sequence.- Parameters:
eventHandlers
- to be called in sequence.
-
-
Method Detail
-
onEvent
public void onEvent(T event, long sequence, boolean endOfBatch) throws Exception
Description copied from interface:EventHandler
Called when a publisher has published an event to theRingBuffer
- Specified by:
onEvent
in interfaceEventHandler<T>
- Parameters:
event
- published to theRingBuffer
sequence
- 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:LifecycleAware
Called once on thread start before first event is available.- Specified by:
onStart
in interfaceLifecycleAware
-
onShutdown
public void onShutdown()
Description copied from interface:LifecycleAware
Called once just before the 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:
onShutdown
in interfaceLifecycleAware
-
-