Class ExecutorUtils

    • Constructor Detail

      • ExecutorUtils

        public ExecutorUtils()
    • Method Detail

      • gracefulShutdown

        public static List<Runnable> gracefulShutdown​(long timeout,
                                                      TimeUnit unit,
                                                      ExecutorService... executorServices)
        Gracefully shutdown the given 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.
        Parameters:
        timeout - to wait for the termination of all ExecutorServices
        unit - of the timeout
        executorServices - to shut down
        Returns:
        Tasks that were not executed prior to a ExecutorService.shutdownNow().