Package org.apache.flink.util
Class ExecutorUtils
- java.lang.Object
-
- org.apache.flink.util.ExecutorUtils
-
-
Constructor Summary
Constructors Constructor Description ExecutorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Runnable>gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices)Gracefully shutdown the givenExecutorService.static CompletableFuture<Void>nonBlockingShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices)Shuts the givenExecutorServicedown in a non-blocking fashion.
-
-
-
Method Detail
-
gracefulShutdown
public static List<Runnable> gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices)
Gracefully shutdown the givenExecutorService. 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.- Parameters:
timeout- to wait for the termination of all ExecutorServicesunit- of the timeoutexecutorServices- to shut down- Returns:
- Tasks that were not executed prior to a
ExecutorService.shutdownNow().
-
nonBlockingShutdown
public static CompletableFuture<Void> nonBlockingShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices)
Shuts the givenExecutorServicedown 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.- Parameters:
timeout- beforeExecutorService.shutdownNow()is calledunit- time unit of the timeoutexecutorServices- to shut down- Returns:
- Future which is completed once the
ExecutorServiceare shut down
-
-