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 ClassesNested classes/interfaces inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
EsThreadPoolExecutor.ShutdownListenerNested 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 voidafterExecute(Runnable r, Throwable t)protected voidbeforeExecute(Thread t, Runnable r)voidorg.elasticsearch.core.TimeValueReturns the waiting time of the first task in the queueintprotected <T> RunnableFuture<T>newTaskFor(Runnable runnable, T value)protected <T> RunnableFuture<T>newTaskFor(Callable<T> callable)protected Runnableprotected RunnablewrapRunnable(Runnable command)Methods inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
appendThreadPoolExecutorDetails, execute, getTasks, terminated, toStringMethods 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:
beforeExecutein classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecutein classEsThreadPoolExecutor
-
execute
-
wrapRunnable
- Overrides:
wrapRunnablein classEsThreadPoolExecutor
-
unwrap
- Overrides:
unwrapin classEsThreadPoolExecutor
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-