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:
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 void
afterExecute
(Runnable r, Throwable t) protected void
Append details about this thread pool to the specifiedStringBuilder
.protected void
beforeExecute
(Thread t, Runnable r) int
Returns the current queue size (operations that are queued)Returns the set of currently running tasks and their start timestamp.double
Returns the exponentially weighted moving average of the task execution timelong
Returns the total time (in nanoseconds) spend executing tasks in this executor.protected Runnable
protected Runnable
wrapRunnable
(Runnable command) Methods inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
execute, getTasks, 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, terminated
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Method Details
-
wrapRunnable
- Overrides:
wrapRunnable
in classEsThreadPoolExecutor
-
unwrap
- Overrides:
unwrap
in 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:
beforeExecute
in classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecute
in classEsThreadPoolExecutor
-
appendThreadPoolExecutorDetails
Description copied from class:EsThreadPoolExecutor
Append details about this thread pool to the specifiedStringBuilder
. All details should be appended as key/value pairs in the form "%s = %s, "- Overrides:
appendThreadPoolExecutorDetails
in classEsThreadPoolExecutor
- Parameters:
sb
- theStringBuilder
to 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.
-