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
AThreadPoolExecutorBase
adapter 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 int
getActiveTaskCount()
Returns the approximate number of threads that are actively executing tasks.long
getCompletedTaskCount()
Returns the approximate total number of tasks that have completed execution.int
getCorePoolSize()
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).int
getCoreThreads()
Returns core pool size of thread pool.int
getMaximumPoolSize()
Returns maximum pool size of thread pool.int
getMaximumThreads()
Returns maximum pool size of thread pool.int
getMaxTasksQueued()
int
getPendingTaskCount()
Returns the approximate total of tasks waiting to be executed.ThreadPoolMetrics
metrics()
static void
register(java.lang.String jmxPath, ThreadPoolExecutorBase executor)
void
run()
void
setCorePoolSize(int corePoolSize)
Allows user to resize minimum size of the thread pool.void
setCoreThreads(int number)
Allows user to resize core pool size of the thread pool.void
setMaximumPoolSize(int maximumPoolSize)
Allows user to resize maximum size of the thread pool.void
setMaximumThreads(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:
run
in interfacejava.lang.Runnable
-
metrics
public ThreadPoolMetrics metrics()
-
getActiveTaskCount
public int getActiveTaskCount()
Description copied from interface:ResizableThreadPool
Returns the approximate number of threads that are actively executing tasks.- Specified by:
getActiveTaskCount
in interfaceResizableThreadPool
- Returns:
- the number of threads
-
getPendingTaskCount
public int getPendingTaskCount()
Description copied from interface:ResizableThreadPool
Returns 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:
getPendingTaskCount
in interfaceResizableThreadPool
- Returns:
- the number of tasks
-
getCoreThreads
public int getCoreThreads()
Description copied from interface:ResizableThreadPoolMXBean
Returns core pool size of thread pool.- Specified by:
getCoreThreads
in interfaceResizableThreadPoolMXBean
-
setCoreThreads
public void setCoreThreads(int number)
Description copied from interface:ResizableThreadPoolMXBean
Allows user to resize core pool size of the thread pool.- Specified by:
setCoreThreads
in interfaceResizableThreadPoolMXBean
-
getMaximumThreads
public int getMaximumThreads()
Description copied from interface:ResizableThreadPoolMXBean
Returns maximum pool size of thread pool.- Specified by:
getMaximumThreads
in interfaceResizableThreadPoolMXBean
-
setMaximumThreads
public void setMaximumThreads(int number)
Description copied from interface:ResizableThreadPoolMXBean
Allows user to resize maximum size of the thread pool.- Specified by:
setMaximumThreads
in interfaceResizableThreadPoolMXBean
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
Description copied from interface:ResizableThreadPool
Allows user to resize minimum size of the thread pool.- Specified by:
setCorePoolSize
in interfaceResizableThreadPool
-
getCorePoolSize
public int getCorePoolSize()
Description copied from interface:ResizableThreadPool
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).- Specified by:
getCorePoolSize
in interfaceResizableThreadPool
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
Description copied from interface:ResizableThreadPool
Allows user to resize maximum size of the thread pool.- Specified by:
setMaximumPoolSize
in interfaceResizableThreadPool
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:ResizableThreadPool
Returns maximum pool size of thread pool.- Specified by:
getMaximumPoolSize
in interfaceResizableThreadPool
-
getCompletedTaskCount
public long getCompletedTaskCount()
Description copied from interface:ResizableThreadPool
Returns 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:
getCompletedTaskCount
in interfaceResizableThreadPool
- Returns:
- the number of tasks
-
getMaxTasksQueued
public int getMaxTasksQueued()
- Specified by:
getMaxTasksQueued
in interfaceResizableThreadPool
-
-