public final class Executors extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Executors.BlockPolicy
A handler for rejected tasks that will have the caller block until space is available.
|
Modifier and Type | Field and Description |
---|---|
static int |
QUEUE_MAX_LENGTH |
Modifier and Type | Method and Description |
---|---|
static ThreadPoolExecutor |
newFixedThreadPool(int threads,
String groupname)
Creates a new fixed size ThreadPoolExecutor.
|
static ThreadPoolExecutor |
newFixedThreadPool(int threads,
String groupname,
int queueSize)
Creates a new fixed size ThreadPoolExecutor
|
static ThreadPoolExecutor |
newScalableThreadPool(int threadsMin,
int threadsMax,
String groupname,
int queueSize)
Creates a dynamically scalable threadpool having an upper bound of threads and queue size
which ultimately falls back to a CallerRunsPolicy.
|
static ScheduledExecutorService |
newScheduledThreadPool(String groupname)
Creates an executor for recurring tasks
|
public static final int QUEUE_MAX_LENGTH
public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname)
threads
- the number of threadsgroupname
- a label to identify the threadpool; useful for profiling.public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname, int queueSize)
threads
- the number of threadsgroupname
- a label to identify the threadpool; useful for profiling.queueSize
- the size of the queue to store Runnables when all threads are busypublic static ThreadPoolExecutor newScalableThreadPool(int threadsMin, int threadsMax, String groupname, int queueSize)
threadsMin
- initial and minimum threadpool sizethreadsMax
- maximumx threadpool sizegroupname
- used to assign nice names to the threads to help diagnostics and tuningqueueSize
- maximum size of the blocking queue holding the workpublic static ScheduledExecutorService newScheduledThreadPool(String groupname)
groupname
- a label to identify the threadpool; useful for profiling.ScheduledThreadPoolExecutor
Copyright © 2006-2015 Red Hat, Inc. All Rights Reserved