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|
will attempt a graceful close in 5 seconds
will attempt a graceful close by the provided time.
public ExecutorCloser(@Nullable @Nullable java.util.concurrent.ExecutorService executorService)
public ExecutorCloser(@Nullable @Nullable java.util.concurrent.ExecutorService executorService, int timeout, java.util.concurrent.TimeUnit unit)
executorService- the executor to close
timeout- the time to wait for
unit- the unit of time
Copyright © 2010 - 2020 Adobe. All Rights Reserved