public final class ThreadPool extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ThreadPool.ThreadPoolThreadFactory
The default thread factory used by the default thread pool.
|
Modifier and Type | Method and Description |
---|---|
static ExecutorService |
getExecutor()
Gets the currently installed
ExecutorService that will execute tasks for
this thread pool. |
static boolean |
queueUserWorkItem(WaitCallback waitCallback)
Queues a method for execution.
|
static boolean |
queueUserWorkItem(WaitCallback waitCallback,
Object state)
Queues a method for execution, and specifies an object containing data to be used
by the method.
|
static void |
setExecutor(ExecutorService value)
Sets the
ExecutorService that will execute tasks for this thread pool. |
@Nonnull public static ExecutorService getExecutor()
ExecutorService
that will execute tasks for
this thread pool.public static void setExecutor(@Nonnull ExecutorService value)
ExecutorService
that will execute tasks for this thread pool. The
threads in the pool should be configured as daemon threads.value
- The new executor.public static boolean queueUserWorkItem(WaitCallback waitCallback)
waitCallback
- A WaitCallback that represents the method to be executed.public static boolean queueUserWorkItem(WaitCallback waitCallback, Object state)
waitCallback
- A WaitCallback representing the method to execute.state
- An object containing data to be used by the method.