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() |
ExecutorService |
createCachedThreadPool(String threadName) |
ExecutorService |
createCachedThreadPool(ThreadFactory factory)
Generates a Cached Thread Pool ExecutorService which has been pre-registered with the
ShutdownManager.
|
ExecutorService |
createFixedThreadPool(int pool) |
ExecutorService |
createFixedThreadPool(int pool,
String threadName) |
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 threadName)
pool
- Size of the fixed pool.threadName
- The name 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 threadName)
threadName
- The name to assign to all threads generated by this executor service.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 2011-2015 ForgeRock AS.