Module org.elasticsearch.server
Class TaskExecutionTimeTrackingEsThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
org.elasticsearch.common.util.concurrent.TaskExecutionTimeTrackingEsThreadPoolExecutor
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
An extension to thread pool executor, which tracks statistics for the task execution time.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterExecute(Runnable r, Throwable t) protected voidAppend details about this thread pool to the specifiedStringBuilder.protected voidbeforeExecute(Thread t, Runnable r) intReturns the current queue size (operations that are queued)doubleReturns the set of currently running tasks and their start timestamp.doubleReturns the exponentially weighted moving average of the task execution timelongReturns the total time (in nanoseconds) spend executing tasks in this executor.protected Runnableprotected RunnablewrapRunnable(Runnable command) Methods inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
execute, getTasks, remove, setCorePoolSize, setMaximumPoolSize, 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, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminatedMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Method Details
-
wrapRunnable
- Overrides:
wrapRunnablein classEsThreadPoolExecutor
-
unwrap
- Overrides:
unwrapin classEsThreadPoolExecutor
-
getTaskExecutionEWMA
public double getTaskExecutionEWMA()Returns the exponentially weighted moving average of the task execution time -
getTotalTaskExecutionTime
public long getTotalTaskExecutionTime()Returns the total time (in nanoseconds) spend executing tasks in this executor. -
getCurrentQueueSize
public int getCurrentQueueSize()Returns the current queue size (operations that are queued) -
beforeExecute
- Overrides:
beforeExecutein classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecutein classEsThreadPoolExecutor
-
appendThreadPoolExecutorDetails
Description copied from class:EsThreadPoolExecutorAppend details about this thread pool to the specifiedStringBuilder. All details should be appended as key/value pairs in the form "%s = %s, "- Overrides:
appendThreadPoolExecutorDetailsin classEsThreadPoolExecutor- Parameters:
sb- theStringBuilderto append to
-
getOngoingTasks
Returns the set of currently running tasks and their start timestamp.Note that it is possible for a task that has just finished execution to be temporarily both in the returned map, and its total execution time to be included in the return value of
getTotalTaskExecutionTime(). However, it is guaranteed that the task is reflected in at least one of those two values. -
getEwmaAlpha
public double getEwmaAlpha()
-