public final class ExecutorServiceUtil extends Object
ExecutorServices.| Modifier and Type | Method and Description |
|---|---|
static <E> BlockingQueue<E> |
offerFailingBlockingQueue(BlockingQueue<E> delegate)
Creates a
BlockingQueue which does not allow for non-blocking addition to the queue. |
static void |
tryGracefulShutdown(ExecutorService executor,
long timeout,
TimeUnit unit)
Tries to shutdown the given executor gracefully by awaiting termination for the given
timeout period.
|
static RejectedExecutionHandler |
waitInQueueExecutionHandler()
Returns a
RejectedExecutionHandler which blocks on the ThreadPoolExecutor's
backing queue if a new thread cannot be spawned. |
public static <E> BlockingQueue<E> offerFailingBlockingQueue(BlockingQueue<E> delegate)
BlockingQueue which does not allow for non-blocking addition to the queue.
This is useful with waitInQueueExecutionHandler() to turn force a
ThreadPoolExecutor to create as many threads as it is configured to before starting
to fill the queue.delegate - Backing blocking queue.public static RejectedExecutionHandler waitInQueueExecutionHandler()
RejectedExecutionHandler which blocks on the ThreadPoolExecutor's
backing queue if a new thread cannot be spawned.public static void tryGracefulShutdown(ExecutorService executor, long timeout, TimeUnit unit)
Copyright © 2018 OpenDaylight. All rights reserved.