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()
Deprecated.
ExecutorServiceFactory.createCachedThreadPool(String) or ExecutorServiceFactory.createCachedThreadPool(ThreadFactory)
should be used so that threads have meaningful names. |
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)
Deprecated.
ExecutorServiceFactory.createFixedThreadPool(int, String) should be used so that threads have meaningful names. |
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)
Deprecated.
ExecutorServiceFactory.createScheduledService(int, String) should be used so that threads have meaningful names. |
ScheduledExecutorService |
createScheduledService(int poolSize,
String threadNamePrefix)
Generates a ScheduledExecutorService which has been pre-registered with the
ShutdownManager.
|
ExecutorService |
createThreadPool(int coreSize,
int maxSize,
long idleTimeout,
TimeUnit timeoutTimeunit,
BlockingQueue<Runnable> runnables)
Deprecated.
ExecutorServiceFactory.createThreadPool(int, int, long, TimeUnit, BlockingQueue, String)
should be used so that threads have meaningful names. |
ExecutorService |
createThreadPool(int coreSize,
int maxSize,
long idleTimeout,
TimeUnit timeoutTimeunit,
BlockingQueue<Runnable> runnables,
String threadNamePrefix)
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.@Deprecated public ScheduledExecutorService createScheduledService(int poolSize)
ExecutorServiceFactory.createScheduledService(int, String)
should be used so that threads have meaningful names.poolSize
- The size of the ScheduledExecutorService thread pool.Executors.newScheduledThreadPool(int)
public ScheduledExecutorService createScheduledService(int poolSize, String threadNamePrefix)
poolSize
- The size of the ScheduledExecutorService thread pool.threadNamePrefix
- The thread name prefix to use when generating new threads.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.ExecutorServiceFactory.createFixedThreadPool(int, java.util.concurrent.ThreadFactory)
@Deprecated public ExecutorService createFixedThreadPool(int pool)
ExecutorServiceFactory.createFixedThreadPool(int, String)
should be used so that threads have meaningful names.pool
- Size of the fixed pool.ExecutorServiceFactory.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.ExecutorServiceFactory.createCachedThreadPool(java.util.concurrent.ThreadFactory)
@Deprecated public ExecutorService createCachedThreadPool()
ExecutorServiceFactory.createCachedThreadPool(String)
or ExecutorServiceFactory.createCachedThreadPool(ThreadFactory)
should be used so that threads have meaningful names.ExecutorServiceFactory.createCachedThreadPool(java.util.concurrent.ThreadFactory)
@Deprecated public ExecutorService createThreadPool(int coreSize, int maxSize, long idleTimeout, TimeUnit timeoutTimeunit, BlockingQueue<Runnable> runnables)
ExecutorServiceFactory.createThreadPool(int, int, long, TimeUnit, BlockingQueue, String)
should be used so that threads have meaningful names.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 runpublic ExecutorService createThreadPool(int coreSize, int maxSize, long idleTimeout, TimeUnit timeoutTimeunit, BlockingQueue<Runnable> runnables, String threadNamePrefix)
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 runthreadNamePrefix
- The thread name prefix to use when generating new threads.Copyright © 2010-2018, ForgeRock All Rights Reserved.