|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.elasticsearch.util.concurrent.DynamicExecutors
public class DynamicExecutors
Factory and utility methods for handling DynamicThreadPoolExecutor
.
Method Summary | |
---|---|
static java.util.concurrent.ThreadFactory |
daemonThreadFactory(Settings settings,
java.lang.String namePrefix)
|
static java.util.concurrent.ThreadFactory |
daemonThreadFactory(java.lang.String namePrefix)
A priority based thread factory, for all Thread priority constants: Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, Thread.MAX_PRIORITY; This factory is used instead of Executers.DefaultThreadFactory to allow manipulation of priority and thread owner name. |
static java.util.concurrent.ExecutorService |
newBlockingThreadPool(int min,
int max,
long keepAliveTime,
int capacity,
long waitTime)
Creates a thread pool similar to that constructed by newScalingThreadPool(int, int, long) , but blocks the call to
execute if the queue has reached it's capacity, and all
max threads are busy handling requests. |
static java.util.concurrent.ExecutorService |
newBlockingThreadPool(int min,
int max,
long keepAliveTime,
int capacity,
long waitTime,
java.util.concurrent.ThreadFactory threadFactory)
Creates a thread pool, same as in newBlockingThreadPool(int, int, long, int, long) , using the
provided ThreadFactory to create new threads when needed. |
static java.util.concurrent.ExecutorService |
newScalingThreadPool(int min,
int max,
long keepAliveTime)
Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. |
static java.util.concurrent.ExecutorService |
newScalingThreadPool(int min,
int max,
long keepAliveTime,
java.util.concurrent.ThreadFactory threadFactory)
Creates a thread pool, same as in newScalingThreadPool(int, int, long) , using the provided
ThreadFactory to create new threads when needed. |
static java.util.concurrent.ThreadFactory |
priorityThreadFactory(int priority,
java.lang.String namePrefix)
A priority based thread factory, for all Thread priority constants: Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, Thread.MAX_PRIORITY; This factory is used instead of Executers.DefaultThreadFactory to allow manipulation of priority and thread owner name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.util.concurrent.ExecutorService newScalingThreadPool(int min, int max, long keepAliveTime)
min
- the number of threads to keep in the pool, even if they are
idle.max
- the maximum number of threads to allow in the pool.keepAliveTime
- when the number of threads is greater than the min,
this is the maximum time that excess idle threads will wait
for new tasks before terminating (in milliseconds).
public static java.util.concurrent.ExecutorService newScalingThreadPool(int min, int max, long keepAliveTime, java.util.concurrent.ThreadFactory threadFactory)
newScalingThreadPool(int, int, long)
, using the provided
ThreadFactory to create new threads when needed.
min
- the number of threads to keep in the pool, even if they are
idle.max
- the maximum number of threads to allow in the pool.keepAliveTime
- when the number of threads is greater than the min,
this is the maximum time that excess idle threads will wait
for new tasks before terminating (in milliseconds).threadFactory
- the factory to use when creating new threads.
public static java.util.concurrent.ExecutorService newBlockingThreadPool(int min, int max, long keepAliveTime, int capacity, long waitTime)
newScalingThreadPool(int, int, long)
, but blocks the call to
execute if the queue has reached it's capacity, and all
max threads are busy handling requests.
If the wait time of this queue has elapsed, a
RejectedExecutionException
will be thrown.
min
- the number of threads to keep in the pool, even if they are
idle.max
- the maximum number of threads to allow in the pool.keepAliveTime
- when the number of threads is greater than the min,
this is the maximum time that excess idle threads will wait
for new tasks before terminating (in milliseconds).capacity
- the fixed capacity of the underlying queue (resembles
backlog).waitTime
- the wait time (in milliseconds) for space to become
available in the queue.
public static java.util.concurrent.ExecutorService newBlockingThreadPool(int min, int max, long keepAliveTime, int capacity, long waitTime, java.util.concurrent.ThreadFactory threadFactory)
newBlockingThreadPool(int, int, long, int, long)
, using the
provided ThreadFactory to create new threads when needed.
min
- the number of threads to keep in the pool, even if they are
idle.max
- the maximum number of threads to allow in the pool.keepAliveTime
- when the number of threads is greater than the min,
this is the maximum time that excess idle threads will wait
for new tasks before terminating (in milliseconds).capacity
- the fixed capacity of the underlying queue (resembles
backlog).waitTime
- the wait time (in milliseconds) for space to become
available in the queue.threadFactory
- the factory to use when creating new threads.
public static java.util.concurrent.ThreadFactory daemonThreadFactory(Settings settings, java.lang.String namePrefix)
public static java.util.concurrent.ThreadFactory daemonThreadFactory(java.lang.String namePrefix)
namePrefix
- a name prefix for this thread
public static java.util.concurrent.ThreadFactory priorityThreadFactory(int priority, java.lang.String namePrefix)
priority
- The priority to be assigned to each thread;
can be either Thread.MIN_PRIORITY, Thread.NORM_PRIORITY
or Thread.MAX_PRIORITY.namePrefix
- a name prefix for this thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |