Class QueueResizingEsThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
-
- org.elasticsearch.common.util.concurrent.QueueResizingEsThreadPoolExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService
public final class QueueResizingEsThreadPoolExecutor extends EsThreadPoolExecutor
An extension to thread pool executor, which automatically adjusts the queue size of theResizableBlockingQueueaccording to Little's Law.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
EsThreadPoolExecutor.ShutdownListener
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description static doubleEWMA_ALPHA
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(java.lang.Runnable r, java.lang.Throwable t)protected voidappendThreadPoolExecutorDetails(java.lang.StringBuilder sb)Append details about this thread pool to the specifiedStringBuilder.protected voiddoExecute(java.lang.Runnable command)intgetCurrentCapacity()Returns the current queue capacityintgetCurrentQueueSize()Returns the current queue size (operations that are queued)doublegetTaskExecutionEWMA()Returns the exponentially weighted moving average of the task execution time-
Methods inherited from class org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor
execute, getTasks, shutdown, terminated, toString, unwrap, wrapRunnable
-
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
-
-
-
-
Method Detail
-
doExecute
protected void doExecute(java.lang.Runnable command)
- Overrides:
doExecutein classEsThreadPoolExecutor
-
getCurrentCapacity
public int getCurrentCapacity()
Returns the current queue capacity
-
getTaskExecutionEWMA
public double getTaskExecutionEWMA()
Returns the exponentially weighted moving average of the task execution time
-
getCurrentQueueSize
public int getCurrentQueueSize()
Returns the current queue size (operations that are queued)
-
afterExecute
protected void afterExecute(java.lang.Runnable r, java.lang.Throwable t)- Overrides:
afterExecutein classEsThreadPoolExecutor
-
appendThreadPoolExecutorDetails
protected void appendThreadPoolExecutorDetails(java.lang.StringBuilder sb)
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
-
-