Package org.graylog2.shared.buffers
Class PartitioningWorkHandler<S extends WorkHandler<T>,T>
java.lang.Object
org.graylog2.shared.buffers.PartitioningWorkHandler<S,T>
- All Implemented Interfaces:
com.lmax.disruptor.EventHandler<T>,com.lmax.disruptor.EventHandlerIdentity
public class PartitioningWorkHandler<S extends WorkHandler<T>,T>
extends Object
implements com.lmax.disruptor.EventHandler<T>
An event handler which will only process a partition of events and which will delegate to
WorkHandler. It
won't make use of batching semantics, therefore it's preferable to implement an EventHandler and handle
partitioning yourself.
Partitioning semantics are implemented as suggested in the disruptor FAQ.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPartitioningWorkHandler(S delegate, long ordinal, long numberOfConsumers) Create an event handler which will only handle a partition of events and doesn't provide support for batching. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidonBatchStart(long arg0, long arg1) final voidvoidvoidonStart()default voidonTimeout(long arg0) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.lmax.disruptor.EventHandler
setSequenceCallback
-
Field Details
-
ordinal
protected final long ordinal -
numberOfConsumers
protected long numberOfConsumers
-
-
Constructor Details
-
PartitioningWorkHandler
Create an event handler which will only handle a partition of events and doesn't provide support for batching.- Parameters:
delegate- A WorkHandler which isordinal- The ordinal number of this consumer in the range [0, numberOfConsumers). Each event handlers need to have a distinct ordinal number.numberOfConsumers- The total number of consumers.
-
-
Method Details
-
onEvent
- Specified by:
onEventin interfacecom.lmax.disruptor.EventHandler<S extends WorkHandler<T>>- Throws:
Exception
-
onStart
public void onStart() -
onShutdown
public void onShutdown() -
getDelegate
-
onBatchStart
default void onBatchStart(long arg0, long arg1) -
onTimeout
- Throws:
Exception
-