Package com.helger.base.concurrent
Class ExecutorServiceHelper
java.lang.Object
com.helger.base.concurrent.ExecutorServiceHelper
Wrapper around an
ExecutorService with additional helper methods.- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull EInterruptshutdownAndWaitUntilAllTasksAreFinished(@NonNull ExecutorService aES) Call shutdown on theExecutorServiceand wait indefinitely until it terminated.static @NonNull EInterruptshutdownAndWaitUntilAllTasksAreFinished(@NonNull ExecutorService aES, long nTimeout, @NonNull TimeUnit eUnit) Call shutdown on theExecutorServiceand wait indefinitely until it terminated.static @NonNull EInterruptwaitUntilAllTasksAreFinished(@NonNull ExecutorService aES) Wait indefinitely on theExecutorServiceuntil it terminates.static @NonNull EInterruptwaitUntilAllTasksAreFinished(@NonNull ExecutorService aES, long nTimeout, @NonNull 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
public static @NonNull 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
public static @NonNull 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
public static @NonNull 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.
-