Class QueueHandler.Builder<E>

java.lang.Object
org.jppf.utils.concurrent.QueueHandler.Builder<E>
Type Parameters:
E - the type of the elements in the queue.
Enclosing interface:
QueueHandler<E>

public static class QueueHandler.Builder<E> extends Object
Builder class for QueueHandler instances.
See Also:
  • Method Details

    • named

      public QueueHandler.Builder<E> named(String name)
      Set the name of the dequeuer threads, or the name prefix if there are more than one thread.
      Parameters:
      name - the name to set.
      Returns:
      this builder, for method call chaining.
    • usingSingleDequuerThread

      public QueueHandler.Builder<E> usingSingleDequuerThread()
      Set the number of dequeuer threads to 1.
      Returns:
      this builder, for method call chaining.
    • usingDequuerThreads

      public QueueHandler.Builder<E> usingDequuerThreads(int nbThreads)
      Set the number of dequeuer threads. If <= 0, then no dequeuing occurs.
      Parameters:
      nbThreads - the number of dequeueing threads.
      Returns:
      this builder, for method call chaining.
    • withCapacity

      public QueueHandler.Builder<E> withCapacity(int capacity)
      Set the capacity (maximum size) of the queue. If <= 0, then the queue is unbounded.
      Parameters:
      capacity - the number of dequeueing threads.
      Returns:
      this builder, for method call chaining.
    • handlingElementsAs

      public QueueHandler.Builder<E> handlingElementsAs(QueueHandler.ElementHandler<E> handler)
      Set the element handler used by the dequeuer threads, if any.
      Parameters:
      handler - the handler to set.
      Returns:
      this builder, for method call chaining.
    • handlingPeakSizeAs

      public QueueHandler.Builder<E> handlingPeakSizeAs(QueueHandler.PeakSizeUpdateCallback peakSizeUpdateCallback)
      Set the function invoked whenever a new peak queue size is reached.
      Parameters:
      peakSizeUpdateCallback - the function to set.
      Returns:
      this builder, for method call chaining.
    • build

      public QueueHandler<E> build()
      COnstruct and configure a QueueHandler instance using previously set configuration pproperties.
      Returns:
      a new QUeueuHandler instance.