public enum ExecutorServiceUtil extends Enum<ExecutorServiceUtil>
ExecutorService
and wait for its termination, with or without forcibly interrupting running tasks.
This is an enum with no instances, serving solely for namespace control.
| Modifier and Type | Method and Description |
|---|---|
static void |
shutdownAndWaitForTermination(ExecutorService executorService)
Shut down an executor service and wait 5 seconds for it to terminate.
|
static void |
shutdownAndWaitForTermination(ExecutorService executorService,
long timeout,
TimeUnit unit)
Shut down an executor service and wait for it to terminate within the given timeout.
|
static void |
shutdownForciblyAndWaitForTermination(ExecutorService executorService)
Shut down an executor service, interrupting all threads, and wait 5 seconds for it to terminate.
|
static void |
shutdownForciblyAndWaitForTermination(ExecutorService executorService,
long timeout,
TimeUnit unit)
Shut down an executor service, interrupting all threads, and wait for it to terminate within the given timeout.
|
static ExecutorServiceUtil |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ExecutorServiceUtil[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static ExecutorServiceUtil[] values()
for (ExecutorServiceUtil c : ExecutorServiceUtil.values()) System.out.println(c);
public static ExecutorServiceUtil valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static void shutdownAndWaitForTermination(ExecutorService executorService, long timeout, TimeUnit unit)
executorService - The executor servicetimeout - The maximum time to waitunit - The unit of the timeout argumentIllegalStateException - If the executor service didn't terminate within the timeoutpublic static void shutdownAndWaitForTermination(ExecutorService executorService)
executorService - The executor serviceIllegalStateException - If it didn't terminate within the default time of 5 secondspublic static void shutdownForciblyAndWaitForTermination(ExecutorService executorService)
executorService - The executor serviceIllegalStateException - If it didn't terminate within the default time of 5 secondspublic static void shutdownForciblyAndWaitForTermination(ExecutorService executorService, long timeout, TimeUnit unit)
executorService - The executor servicetimeout - The maximum time to waitunit - The unit of the timeout argumentIllegalStateException - If it didn't terminate within the specified timeoutCopyright © 2024. All rights reserved.