public final class ExecutorCloser
extends java.lang.Object
implements java.io.Closeable
Utility class to properly close any ExecutorService.
It will attempt a graceful close within the provided timeout. If after such any of the contained tasks are not terminated yet, it will force a shutdown and track a warning in the logs.
| Constructor and Description |
|---|
ExecutorCloser(@Nullable java.util.concurrent.ExecutorService executorService)
will attempt a graceful close in 5 seconds
|
ExecutorCloser(@Nullable java.util.concurrent.ExecutorService executorService,
int timeout,
java.util.concurrent.TimeUnit unit)
will attempt a graceful close by the provided time.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
public ExecutorCloser(@Nullable
@Nullable java.util.concurrent.ExecutorService executorService)
executorService - public ExecutorCloser(@Nullable
@Nullable java.util.concurrent.ExecutorService executorService,
int timeout,
java.util.concurrent.TimeUnit unit)
executorService - the executor to closetimeout - the time to wait forunit - the unit of timeCopyright © 2010 - 2023 Adobe. All Rights Reserved