public class ExecutorServiceFactory extends Object
| Constructor and Description |
|---|
ExecutorServiceFactory(ShutdownManager shutdownManager)
Create an instance of the factory.
|
| Modifier and Type | Method and Description |
|---|---|
ExecutorService |
createCachedThreadPool()
Generates a Cached Thread Pool ExecutorService.
|
ExecutorService |
createCachedThreadPool(String threadNamePrefix)
Generates a Cached Thread Pool ExecutorService using the provided name as a prefix
of the thread names.
|
ExecutorService |
createCachedThreadPool(ThreadFactory factory)
Generates a Cached Thread Pool ExecutorService which has been pre-registered with the
ShutdownManager.
|
ExecutorService |
createFixedThreadPool(int pool)
Create a fixed size Thread Pool ExecutorService.
|
ExecutorService |
createFixedThreadPool(int pool,
String threadNamePrefix)
Create a fixed size Thread Pool ExecutorService using the provided name as the prefix
of the thread names.
|
ExecutorService |
createFixedThreadPool(int pool,
ThreadFactory factory)
Creates a fixed size Thread Pool ExecutorService which has been pre-registered with
the
ShutdownManager. |
ScheduledExecutorService |
createScheduledService(int poolSize)
Generates a ScheduledExecutorService which has been pre-registered with the
ShutdownManager.
|
ExecutorService |
createThreadPool(int coreSize,
int maxSize,
long idleTimeout,
TimeUnit timeoutTimeunit,
BlockingQueue<Runnable> runnables)
Generates a ThreadPoolExecutor with the provided values, and registers that executor as listening for
shutdown messages.
|
public ExecutorServiceFactory(ShutdownManager shutdownManager)
shutdownManager - Required to ensure each ExecutorService will be shutdown.public ScheduledExecutorService createScheduledService(int poolSize)
poolSize - The size of the ScheduledExecutorService thread pool.Executors.newScheduledThreadPool(int)public ExecutorService createFixedThreadPool(int pool, ThreadFactory factory)
ShutdownManager.pool - The size of the pool to create.factory - The ThreadFactory used to generate new threads.public ExecutorService createFixedThreadPool(int pool, String threadNamePrefix)
pool - Size of the fixed pool.threadNamePrefix - The thread name prefix to use when generating new threads.createFixedThreadPool(int, java.util.concurrent.ThreadFactory)public ExecutorService createFixedThreadPool(int pool)
pool - Size of the fixed pool.createFixedThreadPool(int, java.util.concurrent.ThreadFactory)public ExecutorService createCachedThreadPool(ThreadFactory factory)
factory - The ThreadFactory that will be used when generating threads. May not be null.Executors.newCachedThreadPool(java.util.concurrent.ThreadFactory)public ExecutorService createCachedThreadPool(String threadNamePrefix)
threadNamePrefix - The thread name prefix to use when generating new threads.createCachedThreadPool(java.util.concurrent.ThreadFactory)public ExecutorService createCachedThreadPool()
createCachedThreadPool(java.util.concurrent.ThreadFactory)public ExecutorService createThreadPool(int coreSize, int maxSize, long idleTimeout, TimeUnit timeoutTimeunit, BlockingQueue<Runnable> runnables)
coreSize - the number of threads to keep in the pool, even if they are idlemaxSize - Max number of threads in the poolidleTimeout - When the number of threads is greater than core, maximum time that excess idle
threads will wait before terminatingtimeoutTimeunit - The time unit for the idleTimeout argumentrunnables - Queue of threads to be runCopyright © 2025 Open Identity Platform Community. All rights reserved.