public class EsExecutors
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.Integer> |
PROCESSORS_SETTING
Settings key to manually set the number of available processors.
|
Modifier and Type | Method and Description |
---|---|
static java.util.concurrent.ThreadFactory |
daemonThreadFactory(Settings settings,
java.lang.String... names) |
static java.util.concurrent.ThreadFactory |
daemonThreadFactory(Settings settings,
java.lang.String namePrefix) |
static java.util.concurrent.ThreadFactory |
daemonThreadFactory(java.lang.String namePrefix) |
static EsThreadPoolExecutor |
newAutoQueueFixed(java.lang.String name,
int size,
int initialQueueCapacity,
int minQueueSize,
int maxQueueSize,
int frameSize,
TimeValue targetedResponseTime,
java.util.concurrent.ThreadFactory threadFactory,
ThreadContext contextHolder)
Return a new executor that will automatically adjust the queue size based on queue throughput.
|
static java.util.concurrent.ExecutorService |
newDirectExecutorService()
Returns an
ExecutorService that executes submitted tasks on the current thread. |
static EsThreadPoolExecutor |
newFixed(java.lang.String name,
int size,
int queueCapacity,
java.util.concurrent.ThreadFactory threadFactory,
ThreadContext contextHolder) |
static EsThreadPoolExecutor |
newScaling(java.lang.String name,
int min,
int max,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ThreadFactory threadFactory,
ThreadContext contextHolder) |
static PrioritizedEsThreadPoolExecutor |
newSinglePrioritizing(java.lang.String name,
java.util.concurrent.ThreadFactory threadFactory,
ThreadContext contextHolder,
java.util.concurrent.ScheduledExecutorService timer) |
static int |
numberOfProcessors(Settings settings)
Returns the number of available processors.
|
static java.lang.String |
threadName(Settings settings,
java.lang.String... names) |
static java.lang.String |
threadName(Settings settings,
java.lang.String namePrefix) |
static java.lang.String |
threadName(java.lang.String nodeName,
java.lang.String namePrefix) |
public static final Setting<java.lang.Integer> PROCESSORS_SETTING
public static int numberOfProcessors(Settings settings)
Runtime.availableProcessors()
but can be overridden by passing a Settings
instance with the key "processors" set to the desired value.settings
- a Settings
instance from which to derive the available processorspublic static PrioritizedEsThreadPoolExecutor newSinglePrioritizing(java.lang.String name, java.util.concurrent.ThreadFactory threadFactory, ThreadContext contextHolder, java.util.concurrent.ScheduledExecutorService timer)
public static EsThreadPoolExecutor newScaling(java.lang.String name, int min, int max, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.ThreadFactory threadFactory, ThreadContext contextHolder)
public static EsThreadPoolExecutor newFixed(java.lang.String name, int size, int queueCapacity, java.util.concurrent.ThreadFactory threadFactory, ThreadContext contextHolder)
public static EsThreadPoolExecutor newAutoQueueFixed(java.lang.String name, int size, int initialQueueCapacity, int minQueueSize, int maxQueueSize, int frameSize, TimeValue targetedResponseTime, java.util.concurrent.ThreadFactory threadFactory, ThreadContext contextHolder)
size
- number of fixed threads to use for executing tasksinitialQueueCapacity
- initial size of the executor queueminQueueSize
- minimum queue size that the queue can be adjusted tomaxQueueSize
- maximum queue size that the queue can be adjusted toframeSize
- number of tasks during which stats are collected before adjusting queue sizepublic static java.util.concurrent.ExecutorService newDirectExecutorService()
ExecutorService
that executes submitted tasks on the current thread. This executor service does not support being
shutdown.ExecutorService
that executes submitted tasks on the current threadpublic static java.lang.String threadName(Settings settings, java.lang.String... names)
public static java.lang.String threadName(Settings settings, java.lang.String namePrefix)
public static java.lang.String threadName(java.lang.String nodeName, java.lang.String namePrefix)
public static java.util.concurrent.ThreadFactory daemonThreadFactory(Settings settings, java.lang.String namePrefix)
public static java.util.concurrent.ThreadFactory daemonThreadFactory(Settings settings, java.lang.String... names)
public static java.util.concurrent.ThreadFactory daemonThreadFactory(java.lang.String namePrefix)