Class EventHandlerGroup<T>
- Type Parameters:
T
- the type of entry used by the event processors.
EventProcessor
s used as part of the Disruptor
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventHandlerGroup
(Disruptor<T> disruptor, ConsumerRepository<T> consumerRepository, Sequence[] sequences) -
Method Summary
Modifier and TypeMethodDescriptionand
(EventHandlerGroup<T> otherHandlerGroup) Create a new event handler group that combines the consumers in this group with otherHandlerGroup.and
(EventProcessor... processors) Create a new event handler group that combines the handlers in this group with processors.Create a dependency barrier for the processors in this group.final EventHandlerGroup
<T> handleEventsWith
(EventProcessorFactory<T>... eventProcessorFactories) Set up custom event processors to handle events from the ring buffer.final EventHandlerGroup
<T> handleEventsWith
(EventHandler<? super T>... handlers) Set up batch handlers to handle events from the ring buffer.final EventHandlerGroup
<T> handleEventsWithWorkerPool
(WorkHandler<? super T>... handlers) Set up a worker pool to handle events from the ring buffer.final EventHandlerGroup
<T> then
(EventProcessorFactory<T>... eventProcessorFactories) Set up custom event processors to handle events from the ring buffer.final EventHandlerGroup
<T> then
(EventHandler<? super T>... handlers) Set up batch handlers to consume events from the ring buffer.final EventHandlerGroup
<T> thenHandleEventsWithWorkerPool
(WorkHandler<? super T>... handlers) Set up a worker pool to handle events from the ring buffer.
-
Field Details
-
disruptor
-
consumerRepository
-
sequences
-
-
Constructor Details
-
EventHandlerGroup
EventHandlerGroup(Disruptor<T> disruptor, ConsumerRepository<T> consumerRepository, Sequence[] sequences)
-
-
Method Details
-
and
Create a new event handler group that combines the consumers in this group with otherHandlerGroup.- Parameters:
otherHandlerGroup
- the event handler group to combine.- Returns:
- a new EventHandlerGroup combining the existing and new consumers into a single dependency group.
-
and
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
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 handlerB
: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.
-
then
@SafeVarargs public final 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 handlerB
:- Parameters:
eventProcessorFactories
- the event processor factories to use to create the event processors that will process events.- Returns:
- a
EventHandlerGroup
that can be used to chain dependencies.
-
thenHandleEventsWithWorkerPool
@SafeVarargs public final EventHandlerGroup<T> thenHandleEventsWithWorkerPool(WorkHandler<? super T>... handlers) Set up a worker pool to handle events from the ring buffer. The worker pool will only process events after every
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 handlersB, C
:dw.handleEventsWith(A).thenHandleEventsWithWorkerPool(B, C);
- Parameters:
handlers
- the work handlers that will process events. Each work handler instance will provide an extra thread in the worker pool.- Returns:
- a
EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.
-
handleEventsWith
@SafeVarargs public final EventHandlerGroup<T> handleEventsWith(EventHandler<? super T>... handlers) Set up batch handlers to handle 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
A
must process events beforeB
: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.
-
handleEventsWith
@SafeVarargs public final 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 beforeB
:dw.after(A).handleEventsWith(B);
- Parameters:
eventProcessorFactories
- the event processor factories to use to create the event processors that will process events.- Returns:
- a
EventHandlerGroup
that can be used to chain dependencies.
-
handleEventsWithWorkerPool
@SafeVarargs public final EventHandlerGroup<T> handleEventsWithWorkerPool(WorkHandler<? super T>... handlers) Set up a worker pool to handle events from the ring buffer. The worker pool will only process events after every
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 handlersB, C
:dw.after(A).handleEventsWithWorkerPool(B, C);
- Parameters:
handlers
- the work handlers that will process events. Each work handler instance will provide an extra thread in the worker pool.- Returns:
- a
EventHandlerGroup
that can be used to set up a event processor barrier over the created event processors.
-
asSequenceBarrier
Create a dependency barrier for the processors in this group. This allows custom event processors to have dependencies onBatchEventProcessor
s created by the disruptor.- Returns:
- a
SequenceBarrier
including all the processors in this group.
-