com.lmax.disruptor
Class AggregateEventHandler<T>

java.lang.Object
  extended by 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 java.lang.Object
implements EventHandler<T>, LifecycleAware

An aggregate collection of EventHandlers that get called in sequence for each event.


Constructor Summary
AggregateEventHandler(EventHandler<T>... eventHandlers)
          Construct an aggregate collection of EventHandlers to be called in sequence.
 
Method Summary
 void onEvent(T event, long sequence, boolean endOfBatch)
          Called when a publisher has published an event to the RingBuffer
 void onShutdown()
          Called once just before the thread is shutdown.
 void onStart()
          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, wait
 

Constructor Detail

AggregateEventHandler

public AggregateEventHandler(EventHandler<T>... eventHandlers)
Construct an aggregate collection of EventHandlers 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 java.lang.Exception
Description copied from interface: EventHandler
Called when a publisher has published an event to the RingBuffer

Specified by:
onEvent in interface EventHandler<T>
Parameters:
event - published to the RingBuffer
sequence - of the event being processed
endOfBatch - flag to indicate if this is the last event in a batch from the RingBuffer
Throws:
java.lang.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 interface LifecycleAware

onShutdown

public void onShutdown()
Description copied from interface: LifecycleAware
Called once just before the thread is shutdown.

Specified by:
onShutdown in interface LifecycleAware


Copyright © 2011 LMAX Ltd. All Rights Reserved.