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
    Modifier and Type
    Field
    Description
    protected long
     
    protected final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PartitioningWorkHandler(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 Type
    Method
    Description
     
    default void
    onBatchStart(long arg0, long arg1)
     
    final void
    onEvent(T event, long sequence, boolean endOfBatch)
     
    void
     
    void
     
    default void
    onTimeout(long arg0)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.lmax.disruptor.EventHandler

    setSequenceCallback
  • Field Details

    • ordinal

      protected final long ordinal
    • numberOfConsumers

      protected long numberOfConsumers
  • Constructor Details

    • PartitioningWorkHandler

      public PartitioningWorkHandler(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.
      Parameters:
      delegate - A WorkHandler which is
      ordinal - 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

      public final void onEvent(T event, long sequence, boolean endOfBatch) throws Exception
      Specified by:
      onEvent in interface com.lmax.disruptor.EventHandler<S extends WorkHandler<T>>
      Throws:
      Exception
    • onStart

      public void onStart()
    • onShutdown

      public void onShutdown()
    • getDelegate

      public S getDelegate()
    • onBatchStart

      default void onBatchStart(long arg0, long arg1)
    • onTimeout

      default void onTimeout(long arg0) throws Exception
      Throws:
      Exception