Package org.jppf.utils.concurrent
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>
Builder class for
QueueHandler instances.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()COnstruct and configure aQueueHandlerinstance using previously set configuration pproperties.handlingElementsAs(QueueHandler.ElementHandler<E> handler) Set the element handler used by the dequeuer threads, if any.handlingPeakSizeAs(QueueHandler.PeakSizeUpdateCallback peakSizeUpdateCallback) Set the function invoked whenever a new peak queue size is reached.Set the name of the dequeuer threads, or the name prefix if there are more than one thread.usingDequuerThreads(int nbThreads) Set the number of dequeuer threads.Set the number of dequeuer threads to 1.withCapacity(int capacity) Set the capacity (maximum size) of the queue.
-
Method Details
-
named
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
Set the number of dequeuer threads to 1.- Returns:
- this builder, for method call chaining.
-
usingDequuerThreads
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
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
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
COnstruct and configure aQueueHandlerinstance using previously set configuration pproperties.- Returns:
- a new
QUeueuHandlerinstance.
-