Class PrioritizedEsThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor
- All Implemented Interfaces:
Executor
,ExecutorService
A prioritizing executor which uses a priority queue as a work queue. The jobs that will be submitted will be treated
as
PrioritizedRunnable
and/or PrioritizedCallable
, those tasks that are not instances of these two will
be wrapped and assign a default Priority.NORMAL
priority.
Note, if two tasks have the same priority, the first to arrive will be executed first (FIFO style).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
EsThreadPoolExecutor.ShutdownListener
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Constructor Summary
ConstructorDescriptionPrioritizedEsThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, ThreadContext contextHolder, ScheduledExecutorService timer)
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterExecute(Runnable r, Throwable t)
protected void
beforeExecute(Thread t, Runnable r)
void
org.elasticsearch.core.TimeValue
Returns the waiting time of the first task in the queueint
protected <T> RunnableFuture<T>
newTaskFor(Runnable runnable, T value)
protected <T> RunnableFuture<T>
newTaskFor(Callable<T> callable)
protected Runnable
protected Runnable
wrapRunnable(Runnable command)
Methods inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
appendThreadPoolExecutorDetails, execute, getTasks, terminated, toString
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow
-
Constructor Details
-
PrioritizedEsThreadPoolExecutor
public PrioritizedEsThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, ThreadContext contextHolder, ScheduledExecutorService timer)
-
-
Method Details
-
getPending
-
getNumberOfPendingTasks
public int getNumberOfPendingTasks() -
getMaxTaskWaitTime
public org.elasticsearch.core.TimeValue getMaxTaskWaitTime()Returns the waiting time of the first task in the queue -
beforeExecute
- Overrides:
beforeExecute
in classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecute
in classEsThreadPoolExecutor
-
execute
-
wrapRunnable
- Overrides:
wrapRunnable
in classEsThreadPoolExecutor
-
unwrap
- Overrides:
unwrap
in classEsThreadPoolExecutor
-
newTaskFor
- Overrides:
newTaskFor
in classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskFor
in classAbstractExecutorService
-