Class OpenSearchThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.opensearch.common.util.concurrent.OpenSearchThreadPoolExecutor
- All Implemented Interfaces:
Executor
,ExecutorService
- Direct Known Subclasses:
PrioritizedOpenSearchThreadPoolExecutor
,QueueResizingOpenSearchThreadPoolExecutor
An extension to thread pool executor, allowing (in the future) to add specific additional stats to it.
- Opensearch.internal:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Listener on shut downNested 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
.void
long
Returns the cumulative wait time of the ThreadPool.getTasks()
Returns a stream of all pending tasks.protected void
final String
toString()
protected Runnable
protected Runnable
wrapRunnable
(Runnable command) Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, 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
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Method Details
-
terminated
protected void terminated()- Overrides:
terminated
in classThreadPoolExecutor
-
execute
- Specified by:
execute
in interfaceExecutor
- Overrides:
execute
in classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecute
in classThreadPoolExecutor
-
getTasks
Returns a stream of all pending tasks. This is similar toThreadPoolExecutor.getQueue()
but will expose the originally submittedRunnable
instances rather than potentially wrapped ones. -
toString
- Overrides:
toString
in classThreadPoolExecutor
-
appendThreadPoolExecutorDetails
Append details about this thread pool to the specifiedStringBuilder
. All details should be appended as key/value pairs in the form "%s = %s, "- Parameters:
sb
- theStringBuilder
to append to
-
wrapRunnable
-
unwrap
-
getPoolWaitTimeNanos
public long getPoolWaitTimeNanos()Returns the cumulative wait time of the ThreadPool. If the ThreadPool does not support tracking the cumulative pool wait time then this should return -1 which will prevent the value from showing up inThreadPoolStats
. ThreadPools that do support this metric should override this method. For example,QueueResizingOpenSearchThreadPoolExecutor
does so using theTimedRunnable
to get the difference between Runnable creation and execution.
-