com.lmax.disruptor.dsl
Class EventHandlerGroup<T>

java.lang.Object
  extended by com.lmax.disruptor.dsl.EventHandlerGroup<T>
Type Parameters:
T - the type of entry used by the event processors.

public class EventHandlerGroup<T>
extends java.lang.Object

A group of EventProcessors used as part of the Disruptor.


Method Summary
 EventHandlerGroup<T> and(EventHandler<T>... handlers)
          Create a new event handler group that combines the handlers in this group with handlers.
 EventHandlerGroup<T> and(EventProcessor... processors)
          Create a new event handler group that combines the handlers in this group with processors.
 SequenceBarrier asSequenceBarrier()
          Create a dependency barrier for the processors in this group.
 EventHandlerGroup<T> handleEventsWith(EventHandler<T>... handlers)
          Set up batch handlers to handleEventException events from the ring buffer.
 EventHandlerGroup<T> then(EventHandler<T>... handlers)
          Set up batch handlers to consume events from the ring buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

and

public EventHandlerGroup<T> and(EventHandler<T>... handlers)
Create a new event handler group that combines the handlers in this group with handlers.

Parameters:
handlers - the handlers to combine.
Returns:
a new EventHandlerGroup combining the existing and new handlers into a single dependency group.

and

public EventHandlerGroup<T> and(EventProcessor... processors)
Create a new event handler group that combines the handlers in this group with processors.

Parameters:
processors - the processors to combine.
Returns:
a new EventHandlerGroup combining the existing and new processors into a single dependency group.

then

public EventHandlerGroup<T> then(EventHandler<T>... handlers)
Set up batch handlers to consume events from the ring buffer. These handlers will only process events after every EventProcessor in this group has processed the event.

This method is generally used as part of a chain. For example if the handler A must process events before handler B:

dw.handleEventsWith(A).then(B);

Parameters:
handlers - the batch handlers that will process events.
Returns:
a EventHandlerGroup that can be used to set up a event processor barrier over the created event processors.

handleEventsWith

public EventHandlerGroup<T> handleEventsWith(EventHandler<T>... handlers)
Set up batch handlers to handleEventException events from the ring buffer. These handlers will only process events after every EventProcessor in this group has processed the event.

This method is generally used as part of a chain. For example if the handler A must process events before handler B:

dw.after(A).handleEventsWith(B);

Parameters:
handlers - the batch handlers that will process events.
Returns:
a EventHandlerGroup that can be used to set up a event processor barrier over the created event processors.

asSequenceBarrier

public SequenceBarrier asSequenceBarrier()
Create a dependency barrier for the processors in this group. This allows custom event processors to have dependencies on BatchEventProcessors created by the disruptor.

Returns:
a SequenceBarrier including all the processors in this group.


Copyright © 2011 LMAX Ltd. All Rights Reserved.