public interface ThreadPool
This interface encapsulates a thread pool for execution of CPU bound tasks plus an I/O service for execution of I/O / async operations
The thread pool designated to execute CPU bound operations and async callbacks can be regular fixed size thread
pool (GeneralPurpose) or work stealing queue thread pool (WorkStealing) and all 3 types of thread pools are also
global singletons which can be acquired via getInstance(ThreadPoolId)
| Modifier and Type | Interface and Description |
|---|---|
static class |
ThreadPool.ThreadPoolId
The thread pool ids of the JVM wide global thread pools.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.ExecutorService |
executorService()
Returns the executor service associated with the thread pool.
|
static ThreadPool |
getInstance(ThreadPool.ThreadPoolId threadPoolId)
Obtains the respective global / JVM wide thread pool instance.
|
ThreadPool.ThreadPoolId |
id() |
java.nio.channels.AsynchronousChannelGroup |
ioService()
Returns the I/O service associated with the thread pool.
|
void |
shutdown()
Shuts down the thread pool.
|
void shutdown()
After the thread pool is shutdown any attempts to use it will throw an exception
ThreadPool.ThreadPoolId id()
java.nio.channels.AsynchronousChannelGroup ioService()
If invoked on a thread pool which does not have an I/O service associated with it it will throw an exception
java.util.concurrent.ExecutorService executorService()
static ThreadPool getInstance(ThreadPool.ThreadPoolId threadPoolId)
Note that this is lazy initialization singleton and the thread pool maybe initialized on the first call
threadPoolId - The thread pool id of the global instance requested