| Constructor and Description |
|---|
ExecutorUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
gracefulShutdown(long timeout,
TimeUnit unit,
ExecutorService... executorServices)
Gracefully shutdown the given
ExecutorService. |
static CompletableFuture<Void> |
nonBlockingShutdown(long timeout,
TimeUnit unit,
ExecutorService... executorServices)
Shuts the given
ExecutorService down in a non-blocking fashion. |
public static void gracefulShutdown(long timeout,
TimeUnit unit,
ExecutorService... executorServices)
ExecutorService. The call waits the given timeout that
all ExecutorServices terminate. If the ExecutorServices do not terminate in this time, they
will be shut down hard.timeout - to wait for the termination of all ExecutorServicesunit - of the timeoutexecutorServices - to shut downpublic static CompletableFuture<Void> nonBlockingShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices)
ExecutorService down in a non-blocking fashion. The shut down will be
executed by a thread from the common fork-join pool.
The executor services will be shut down gracefully for the given timeout period.
Afterwards ExecutorService.shutdownNow() will be called.
timeout - before ExecutorService.shutdownNow() is calledunit - time unit of the timeoutexecutorServices - to shut downExecutorService are shut downCopyright © 2023–2024 The Apache Software Foundation. All rights reserved.