public class ExecutorServiceUtils
extends java.lang.Object
| Constructor and Description |
|---|
ExecutorServiceUtils() |
| Modifier and Type | Method and Description |
|---|---|
void |
gracefulShutdown(java.util.concurrent.ExecutorService service,
java.time.Duration timeout)
Gracefully shuts down the given executor service.
|
public void gracefulShutdown(java.util.concurrent.ExecutorService service,
java.time.Duration timeout)
throws java.lang.InterruptedException
Adopted from the Oracle JAVA Documentation.
service - the service to shutdowntimeout - max wait time for the tasks to shutdown. Note that the max wait time is 2
times this value due to the two stages shutdown strategy.java.lang.InterruptedException - if the current thread is interrupted