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:
- 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 SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceWe expect the work queue to be empty fairly frequently; if the queue remains nonempty for sufficiently long then there's a risk that some lower-priority tasks are being starved of access to the executor.Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutorThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
- 
Constructor SummaryConstructorsConstructorDescriptionPrioritizedEsThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, ThreadContext contextHolder, ScheduledExecutorService timer, PrioritizedEsThreadPoolExecutor.StarvationWatcher starvationWatcher) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidafterExecute(Runnable r, Throwable t) protected voidbeforeExecute(Thread t, Runnable r) voidReturns 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.EsThreadPoolExecutorappendThreadPoolExecutorDetails, execute, getTasks, toStringMethods inherited from class java.util.concurrent.ThreadPoolExecutorallowCoreThreadTimeOut, 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, terminated
- 
Constructor Details- 
PrioritizedEsThreadPoolExecutorpublic PrioritizedEsThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, ThreadContext contextHolder, ScheduledExecutorService timer, PrioritizedEsThreadPoolExecutor.StarvationWatcher starvationWatcher) 
 
- 
- 
Method Details- 
getPending
- 
getNumberOfPendingTaskspublic int getNumberOfPendingTasks()
- 
getMaxTaskWaitTimeReturns the waiting time of the first task in the queue
- 
beforeExecute- Overrides:
- beforeExecutein class- ThreadPoolExecutor
 
- 
afterExecute- Overrides:
- afterExecutein class- EsThreadPoolExecutor
 
- 
execute
- 
wrapRunnable- Overrides:
- wrapRunnablein class- EsThreadPoolExecutor
 
- 
unwrap- Overrides:
- unwrapin class- EsThreadPoolExecutor
 
- 
newTaskFor- Overrides:
- newTaskForin class- AbstractExecutorService
 
- 
newTaskFor- Overrides:
- newTaskForin class- AbstractExecutorService
 
 
-