Package org.apache.cassandra.concurrent
Class ThreadPoolExecutorJMXAdapter
- java.lang.Object
-
- org.apache.cassandra.concurrent.ThreadPoolExecutorJMXAdapter
-
- All Implemented Interfaces:
java.lang.Runnable,ResizableThreadPool,ResizableThreadPoolMXBean
public class ThreadPoolExecutorJMXAdapter extends java.lang.Object implements java.lang.Runnable, ResizableThreadPoolMXBean
AThreadPoolExecutorBaseadapter to expose it via JMX. The executor is not itself modified to maximise code re-use. Only its rejected execution handler is updated, and a shutdown listener is registered.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetActiveTaskCount()Returns the approximate number of threads that are actively executing tasks.longgetCompletedTaskCount()Returns the approximate total number of tasks that have completed execution.intgetCorePoolSize()Returns core pool size of thread pool, the minimum number of workers (where that makes sense for a thread pool, SEPExecutor does not have a minimum size).intgetCoreThreads()Returns core pool size of thread pool.intgetMaximumPoolSize()Returns maximum pool size of thread pool.intgetMaximumThreads()Returns maximum pool size of thread pool.intgetMaxTasksQueued()intgetPendingTaskCount()Returns the approximate total of tasks waiting to be executed.ThreadPoolMetricsmetrics()static voidregister(java.lang.String jmxPath, ThreadPoolExecutorBase executor)voidrun()voidsetCorePoolSize(int corePoolSize)Allows user to resize minimum size of the thread pool.voidsetCoreThreads(int number)Allows user to resize core pool size of the thread pool.voidsetMaximumPoolSize(int maximumPoolSize)Allows user to resize maximum size of the thread pool.voidsetMaximumThreads(int number)Allows user to resize maximum size of the thread pool.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.concurrent.ResizableThreadPool
oldestTaskQueueTime
-
-
-
-
Method Detail
-
register
public static void register(java.lang.String jmxPath, ThreadPoolExecutorBase executor)
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
metrics
public ThreadPoolMetrics metrics()
-
getActiveTaskCount
public int getActiveTaskCount()
Description copied from interface:ResizableThreadPoolReturns the approximate number of threads that are actively executing tasks.- Specified by:
getActiveTaskCountin interfaceResizableThreadPool- Returns:
- the number of threads
-
getPendingTaskCount
public int getPendingTaskCount()
Description copied from interface:ResizableThreadPoolReturns the approximate total of tasks waiting to be executed. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation.- Specified by:
getPendingTaskCountin interfaceResizableThreadPool- Returns:
- the number of tasks
-
getCoreThreads
public int getCoreThreads()
Description copied from interface:ResizableThreadPoolMXBeanReturns core pool size of thread pool.- Specified by:
getCoreThreadsin interfaceResizableThreadPoolMXBean
-
setCoreThreads
public void setCoreThreads(int number)
Description copied from interface:ResizableThreadPoolMXBeanAllows user to resize core pool size of the thread pool.- Specified by:
setCoreThreadsin interfaceResizableThreadPoolMXBean
-
getMaximumThreads
public int getMaximumThreads()
Description copied from interface:ResizableThreadPoolMXBeanReturns maximum pool size of thread pool.- Specified by:
getMaximumThreadsin interfaceResizableThreadPoolMXBean
-
setMaximumThreads
public void setMaximumThreads(int number)
Description copied from interface:ResizableThreadPoolMXBeanAllows user to resize maximum size of the thread pool.- Specified by:
setMaximumThreadsin interfaceResizableThreadPoolMXBean
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
Description copied from interface:ResizableThreadPoolAllows user to resize minimum size of the thread pool.- Specified by:
setCorePoolSizein interfaceResizableThreadPool
-
getCorePoolSize
public int getCorePoolSize()
Description copied from interface:ResizableThreadPoolReturns core pool size of thread pool, the minimum number of workers (where that makes sense for a thread pool, SEPExecutor does not have a minimum size).- Specified by:
getCorePoolSizein interfaceResizableThreadPool
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
Description copied from interface:ResizableThreadPoolAllows user to resize maximum size of the thread pool.- Specified by:
setMaximumPoolSizein interfaceResizableThreadPool
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:ResizableThreadPoolReturns maximum pool size of thread pool.- Specified by:
getMaximumPoolSizein interfaceResizableThreadPool
-
getCompletedTaskCount
public long getCompletedTaskCount()
Description copied from interface:ResizableThreadPoolReturns the approximate total number of tasks that have completed execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls.- Specified by:
getCompletedTaskCountin interfaceResizableThreadPool- Returns:
- the number of tasks
-
getMaxTasksQueued
public int getMaxTasksQueued()
- Specified by:
getMaxTasksQueuedin interfaceResizableThreadPool
-
-