Package com.helger.commons.concurrent
Class ExecutorServiceHelper
java.lang.Object
com.helger.commons.concurrent.ExecutorServiceHelper
Wrapper around an
ExecutorService with additional helper methods.- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic EInterruptCall shutdown on theExecutorServiceand wait indefinitely until it terminated.static EInterruptshutdownAndWaitUntilAllTasksAreFinished(ExecutorService aES, long nTimeout, TimeUnit eUnit) Call shutdown on theExecutorServiceand wait indefinitely until it terminated.static EInterruptWait indefinitely on theExecutorServiceuntil it terminates.static EInterruptwaitUntilAllTasksAreFinished(ExecutorService aES, long nTimeout, TimeUnit eUnit) Wait indefinitely on theExecutorServiceuntil it terminates.
-
Method Details
-
waitUntilAllTasksAreFinished
Wait indefinitely on theExecutorServiceuntil it terminates.- Parameters:
aES- TheExecutorServiceto operate on. May not benull.- Returns:
EInterrupt.INTERRUPTEDif the executor service was interrupted while awaiting termination. Nevernull.
-
waitUntilAllTasksAreFinished
@Nonnull public static EInterrupt waitUntilAllTasksAreFinished(@Nonnull ExecutorService aES, @Nonnegative long nTimeout, @Nonnull TimeUnit eUnit) Wait indefinitely on theExecutorServiceuntil it terminates.- Parameters:
aES- TheExecutorServiceto operate on. May not benull.nTimeout- the maximum time to wait. Must be > 0.eUnit- the time unit of the timeout argument. Must not benull.- Returns:
EInterrupt.INTERRUPTEDif the executor service was interrupted while awaiting termination. Nevernull.
-
shutdownAndWaitUntilAllTasksAreFinished
@Nonnull public static EInterrupt shutdownAndWaitUntilAllTasksAreFinished(@Nonnull ExecutorService aES) Call shutdown on theExecutorServiceand wait indefinitely until it terminated.- Parameters:
aES- TheExecutorServiceto operate on. May not benull.- Returns:
EInterrupt.INTERRUPTEDif the executor service was interrupted while awaiting termination. Nevernull.
-
shutdownAndWaitUntilAllTasksAreFinished
@Nonnull public static EInterrupt shutdownAndWaitUntilAllTasksAreFinished(@Nonnull ExecutorService aES, @Nonnegative long nTimeout, @Nonnull TimeUnit eUnit) Call shutdown on theExecutorServiceand wait indefinitely until it terminated.- Parameters:
aES- TheExecutorServiceto operate on. May not benull.nTimeout- the maximum time to wait. Must be > 0.eUnit- the time unit of the timeout argument. Must not benull.- Returns:
EInterrupt.INTERRUPTEDif the executor service was interrupted while awaiting termination. Nevernull.
-