Package org.jivesoftware.openfire.mbean
Class ThreadPoolExecutorDelegate
- java.lang.Object
-
- org.jivesoftware.openfire.mbean.ThreadPoolExecutorDelegate
-
- All Implemented Interfaces:
ThreadPoolExecutorDelegateMBean
public class ThreadPoolExecutorDelegate extends Object implements ThreadPoolExecutorDelegateMBean
A delegate for aThreadPoolExecutor
instance, to expose a subset of its functionality as an MBean (as defined byThreadPoolExecutorDelegateMBean
.- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
-
Field Summary
-
Fields inherited from interface org.jivesoftware.openfire.mbean.ThreadPoolExecutorDelegateMBean
BASE_OBJECT_NAME
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolExecutorDelegate(ThreadPoolExecutor delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getActiveCount()
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 the core number of threads.int
getLargestPoolSize()
Returns the largest number of threads that have ever simultaneously been in the pool.int
getMaximumPoolSize()
Returns the maximum allowed number of threads.int
getPoolSize()
Returns the current number of threads in the pool.int
getQueuedTaskCount()
Returns the number of tasks that are currently waiting to be executed by the delegate executor.int
getQueueRemainingCapacity()
Returns the number of additional elements that task queue used by the delegate executor can ideally (in the absence of memory or resource constraints) accept without blocking, orInteger.MAX_VALUE
if there is no intrinsic limit.long
getTaskCount()
Returns the approximate total number of tasks that have ever been scheduled for execution.
-
-
-
Constructor Detail
-
ThreadPoolExecutorDelegate
public ThreadPoolExecutorDelegate(@Nonnull ThreadPoolExecutor delegate)
-
-
Method Detail
-
getCorePoolSize
public int getCorePoolSize()
Returns the core number of threads.- Specified by:
getCorePoolSize
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the core number of threads
-
getPoolSize
public int getPoolSize()
Returns the current number of threads in the pool.- Specified by:
getPoolSize
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the number of threads
-
getLargestPoolSize
public int getLargestPoolSize()
Returns the largest number of threads that have ever simultaneously been in the pool.- Specified by:
getLargestPoolSize
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the number of threads
-
getMaximumPoolSize
public int getMaximumPoolSize()
Returns the maximum allowed number of threads.- Specified by:
getMaximumPoolSize
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the maximum allowed number of threads
-
getActiveCount
public int getActiveCount()
Returns the approximate number of threads that are actively executing tasks.- Specified by:
getActiveCount
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the number of threads
-
getQueuedTaskCount
public int getQueuedTaskCount()
Returns the number of tasks that are currently waiting to be executed by the delegate executor.- Specified by:
getQueuedTaskCount
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the task queue size
-
getQueueRemainingCapacity
public int getQueueRemainingCapacity()
Returns the number of additional elements that task queue used by the delegate executor can ideally (in the absence of memory or resource constraints) accept without blocking, orInteger.MAX_VALUE
if there is no intrinsic limit.- Specified by:
getQueueRemainingCapacity
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the remaining capacity
-
getTaskCount
public long getTaskCount()
Returns the approximate total number of tasks that have ever been scheduled for execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation.- Specified by:
getTaskCount
in interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the number of tasks
-
getCompletedTaskCount
public long getCompletedTaskCount()
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 interfaceThreadPoolExecutorDelegateMBean
- Returns:
- the number of tasks
-
-