T
- the type of entry used by the event processors.public class EventHandlerGroup<T>
extends java.lang.Object
EventProcessor
s used as part of the Disruptor
.Modifier and Type | Field and Description |
---|---|
private ConsumerRepository<T> |
consumerRepository |
private Disruptor<T> |
disruptor |
private Sequence[] |
sequences |
Constructor and Description |
---|
EventHandlerGroup(Disruptor<T> disruptor,
ConsumerRepository<T> consumerRepository,
Sequence[] sequences) |
Modifier and Type | Method and Description |
---|---|
EventHandlerGroup<T> |
and(EventHandlerGroup<T> otherHandlerGroup)
Create a new event handler group that combines the consumers in this group with otherHandlerGroup.
|
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<? super T>... handlers)
Set up batch handlers to handle events from the ring buffer.
|
EventHandlerGroup<T> |
handleEventsWith(EventProcessorFactory<T>... eventProcessorFactories)
Set up custom event processors to handle events from the ring buffer.
|
EventHandlerGroup<T> |
handleEventsWithWorkerPool(WorkHandler<? super T>... handlers)
Set up a worker pool to handle events from the ring buffer.
|
EventHandlerGroup<T> |
then(EventHandler<? super T>... handlers)
Set up batch handlers to consume events from the ring buffer.
|
EventHandlerGroup<T> |
then(EventProcessorFactory<T>... eventProcessorFactories)
Set up custom event processors to handle events from the ring buffer.
|
EventHandlerGroup<T> |
thenHandleEventsWithWorkerPool(WorkHandler<? super T>... handlers)
Set up a worker pool to handle events from the ring buffer.
|
private final ConsumerRepository<T> consumerRepository
private final Sequence[] sequences
EventHandlerGroup(Disruptor<T> disruptor, ConsumerRepository<T> consumerRepository, Sequence[] sequences)
public EventHandlerGroup<T> and(EventHandlerGroup<T> otherHandlerGroup)
otherHandlerGroup
- the event handler group to combine.public EventHandlerGroup<T> and(EventProcessor... processors)
processors
- the processors to combine.public EventHandlerGroup<T> then(EventHandler<? super T>... handlers)
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);
handlers
- the batch handlers that will process events.EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.public EventHandlerGroup<T> then(EventProcessorFactory<T>... eventProcessorFactories)
Set up custom event processors to handle events from the ring buffer. The Disruptor will
automatically start these processors when Disruptor.start()
is called.
This method is generally used as part of a chain. For example if the handler A
must
process events before handler B
:
eventProcessorFactories
- the event processor factories to use to create the event processors that will process events.EventHandlerGroup
that can be used to chain dependencies.public EventHandlerGroup<T> thenHandleEventsWithWorkerPool(WorkHandler<? super T>... handlers)
EventProcessor
in this group has processed the event. Each event will be processed
by one of the work handler instances.
This method is generally used as part of a chain. For example if the handler A
must
process events before the worker pool with handlers B, C
:
dw.handleEventsWith(A).thenHandleEventsWithWorkerPool(B, C);
handlers
- the work handlers that will process events. Each work handler instance will provide an extra thread in the worker pool.EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.public EventHandlerGroup<T> handleEventsWith(EventHandler<? super T>... handlers)
EventProcessor
in this group has processed the event.
This method is generally used as part of a chain. For example if A
must
process events before B
:
dw.after(A).handleEventsWith(B);
handlers
- the batch handlers that will process events.EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.public EventHandlerGroup<T> handleEventsWith(EventProcessorFactory<T>... eventProcessorFactories)
Set up custom event processors to handle events from the ring buffer. The Disruptor will
automatically start these processors when Disruptor.start()
is called.
This method is generally used as part of a chain. For example if A
must
process events before B
:
dw.after(A).handleEventsWith(B);
eventProcessorFactories
- the event processor factories to use to create the event processors that will process events.EventHandlerGroup
that can be used to chain dependencies.public EventHandlerGroup<T> handleEventsWithWorkerPool(WorkHandler<? super T>... handlers)
EventProcessor
in this group has processed the event. Each event will be processed
by one of the work handler instances.
This method is generally used as part of a chain. For example if the handler A
must
process events before the worker pool with handlers B, C
:
dw.after(A).handleEventsWithWorkerPool(B, C);
handlers
- the work handlers that will process events. Each work handler instance will provide an extra thread in the worker pool.EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.public SequenceBarrier asSequenceBarrier()
BatchEventProcessor
s created by the disruptor.SequenceBarrier
including all the processors in this group.