public final class ThreadPoolUtils
extends java.lang.Object
ExecutorService.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_SHUTDOWN_AWAIT_TERMINATION |
| Constructor and Description |
|---|
ThreadPoolUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
awaitTermination(java.util.concurrent.ExecutorService executorService,
long shutdownAwaitTermination)
Awaits the termination of the thread pool.
|
static void |
shutdown(java.util.concurrent.ExecutorService executorService)
Shutdown the given executor service only (ie not graceful shutdown).
|
static void |
shutdownGraceful(java.util.concurrent.ExecutorService executorService)
Shutdown the given executor service graceful at first, and then aggressively
if the await termination timeout was hit.
|
static void |
shutdownGraceful(java.util.concurrent.ExecutorService executorService,
long shutdownAwaitTermination)
Shutdown the given executor service graceful at first, and then aggressively
if the await termination timeout was hit.
|
static java.util.List<java.lang.Runnable> |
shutdownNow(java.util.concurrent.ExecutorService executorService)
Shutdown now the given executor service aggressively.
|
public static final long DEFAULT_SHUTDOWN_AWAIT_TERMINATION
public static void shutdown(java.util.concurrent.ExecutorService executorService)
ExecutorService.shutdown()public static java.util.List<java.lang.Runnable> shutdownNow(java.util.concurrent.ExecutorService executorService)
executorService - the executor service to shutdown nowExecutorService.shutdownNow()public static void shutdownGraceful(java.util.concurrent.ExecutorService executorService)
shutdownGraceful(java.util.concurrent.ExecutorService, long)
with a timeout value of DEFAULT_SHUTDOWN_AWAIT_TERMINATION millis.public static void shutdownGraceful(java.util.concurrent.ExecutorService executorService,
long shutdownAwaitTermination)
shutdownNow(java.util.concurrent.ExecutorService) which
forces a shutdown. The parameter shutdownAwaitTermination
is used as timeout value waiting for orderly shutdown to
complete normally, before going aggressively.executorService - the executor service to shutdownshutdownAwaitTermination - timeout in millis to wait for orderly shutdownpublic static boolean awaitTermination(java.util.concurrent.ExecutorService executorService,
long shutdownAwaitTermination)
throws java.lang.InterruptedException
executorService - the thread poolshutdownAwaitTermination - time in millis to use as timeoutjava.lang.InterruptedException - is thrown if we are interrupted during the waitingCopyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.