Package com.helger.commons.concurrent
Class ExecutorServiceHelper
- java.lang.Object
-
- com.helger.commons.concurrent.ExecutorServiceHelper
-
@Immutable public final class ExecutorServiceHelper extends Object
Wrapper around anExecutorServicewith additional helper methods.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EInterruptshutdownAndWaitUntilAllTasksAreFinished(ExecutorService aES)Call 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 EInterruptwaitUntilAllTasksAreFinished(ExecutorService aES)Wait indefinitely on theExecutorServiceuntil it terminates.static EInterruptwaitUntilAllTasksAreFinished(ExecutorService aES, long nTimeout, TimeUnit eUnit)Wait indefinitely on theExecutorServiceuntil it terminates.
-
-
-
Method Detail
-
waitUntilAllTasksAreFinished
@Nonnull public static EInterrupt waitUntilAllTasksAreFinished(@Nonnull ExecutorService aES)
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.
-
-