Module org.elasticsearch.server
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:
AutoCloseable
,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 ClassesNested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Constructor Summary
ConstructorsConstructorDescriptionPrioritizedEsThreadPoolExecutor
(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
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, remove, setCorePoolSize, setMaximumPoolSize, 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, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
close
-
Constructor Details
-
PrioritizedEsThreadPoolExecutor
public PrioritizedEsThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, ThreadContext contextHolder, ScheduledExecutorService timer)
-
-
Method Details
-
getPending
-
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
-