Class ThreadExecutorStatsMXBeanImpl
- java.lang.Object
-
- org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean
-
- org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl
-
- All Implemented Interfaces:
ThreadExecutorStatsMXBean
public class ThreadExecutorStatsMXBeanImpl extends AbstractMXBean implements ThreadExecutorStatsMXBean
MXBean implementation of the ThreadExecutorStatsMXBean interface that retrieves statistics from a backingExecutorService.- Author:
- Thomas Pantelis
-
-
Field Summary
-
Fields inherited from class org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean
BASE_JMX_PREFIX
-
-
Constructor Summary
Constructors Constructor Description ThreadExecutorStatsMXBeanImpl(ThreadPoolExecutor executor, String beanName, String beanType, @Nullable String beanCategory)Constructs an instance for the givenExecutor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ThreadExecutorStatsMXBeanImplcreate(Executor executor)Creates a new bean if the backing executor is a ThreadPoolExecutor.static ThreadExecutorStatsMXBeanImplcreate(Executor executor, String beanName, String beanType)Creates a new bean if the backing executor is a ThreadPoolExecutor and registers it.static ThreadExecutorStatsMXBeanImplcreate(Executor executor, String beanName, String beanType, @Nullable String beanCategory)Creates a new bean if the backing executor is a ThreadPoolExecutor and registers it.longgetActiveThreadCount()Returns the active thread count.longgetCompletedTaskCount()Returns the completed task count.longgetCurrentQueueSize()Returns the current queue size.longgetCurrentThreadPoolSize()Returns the current thread pool size.LonggetLargestQueueSize()Returns the largest queue size, if available.longgetLargestThreadPoolSize()Returns the largest thread pool size.longgetMaxQueueSize()Returns the maximum queue size.longgetMaxThreadPoolSize()Returns the maximum thread pool size.LonggetRejectedTaskCount()Returns the rejected task count, if available.longgetTotalTaskCount()Returns the total task count.ThreadExecutorStatstoThreadExecutorStats()Returns aThreadExecutorStatsinstance containing a snapshot of the statistic metrics.-
Methods inherited from class org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean
getMBeanCategory, getMBeanName, getMBeanType, register, registerMBean, unregister, unregisterMBean
-
-
-
-
Constructor Detail
-
ThreadExecutorStatsMXBeanImpl
public ThreadExecutorStatsMXBeanImpl(ThreadPoolExecutor executor, String beanName, String beanType, @Nullable String beanCategory)
Constructs an instance for the givenExecutor.- Parameters:
executor- the backingExecutorbeanName- Used as thenameproperty in the bean's ObjectName.beanType- Used as thetypeproperty in the bean's ObjectName.beanCategory- Used as theCategoryproperty in the bean's ObjectName.
-
-
Method Detail
-
create
public static ThreadExecutorStatsMXBeanImpl create(Executor executor, String beanName, String beanType, @Nullable String beanCategory)
Creates a new bean if the backing executor is a ThreadPoolExecutor and registers it.- Parameters:
executor- the backingExecutorbeanName- Used as thenameproperty in the bean's ObjectName.beanType- Used as thetypeproperty in the bean's ObjectName.beanCategory- Used as theCategoryproperty in the bean's ObjectName.- Returns:
- a registered ThreadExecutorStatsMXBeanImpl instance if the backing executor is a ThreadPoolExecutor, otherwise null.
-
create
public static ThreadExecutorStatsMXBeanImpl create(Executor executor, String beanName, String beanType)
Creates a new bean if the backing executor is a ThreadPoolExecutor and registers it.- Parameters:
executor- the backingExecutorbeanName- Used as thenameproperty in the bean's ObjectName.beanType- Used as thetypeproperty in the bean's ObjectName.- Returns:
- a registered ThreadExecutorStatsMXBeanImpl instance if the backing executor is a ThreadPoolExecutor, otherwise null.
-
create
public static ThreadExecutorStatsMXBeanImpl create(Executor executor)
Creates a new bean if the backing executor is a ThreadPoolExecutor.- Parameters:
executor- the backingExecutor- Returns:
- a ThreadExecutorStatsMXBeanImpl instance if the backing executor is a ThreadPoolExecutor, otherwise null.
-
getCurrentThreadPoolSize
public long getCurrentThreadPoolSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the current thread pool size.- Specified by:
getCurrentThreadPoolSizein interfaceThreadExecutorStatsMXBean
-
getLargestThreadPoolSize
public long getLargestThreadPoolSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the largest thread pool size.- Specified by:
getLargestThreadPoolSizein interfaceThreadExecutorStatsMXBean
-
getMaxThreadPoolSize
public long getMaxThreadPoolSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the maximum thread pool size.- Specified by:
getMaxThreadPoolSizein interfaceThreadExecutorStatsMXBean
-
getCurrentQueueSize
public long getCurrentQueueSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the current queue size.- Specified by:
getCurrentQueueSizein interfaceThreadExecutorStatsMXBean
-
getLargestQueueSize
public Long getLargestQueueSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the largest queue size, if available.- Specified by:
getLargestQueueSizein interfaceThreadExecutorStatsMXBean
-
getMaxQueueSize
public long getMaxQueueSize()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the maximum queue size.- Specified by:
getMaxQueueSizein interfaceThreadExecutorStatsMXBean
-
getActiveThreadCount
public long getActiveThreadCount()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the active thread count.- Specified by:
getActiveThreadCountin interfaceThreadExecutorStatsMXBean
-
getCompletedTaskCount
public long getCompletedTaskCount()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the completed task count.- Specified by:
getCompletedTaskCountin interfaceThreadExecutorStatsMXBean
-
getTotalTaskCount
public long getTotalTaskCount()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the total task count.- Specified by:
getTotalTaskCountin interfaceThreadExecutorStatsMXBean
-
getRejectedTaskCount
public Long getRejectedTaskCount()
Description copied from interface:ThreadExecutorStatsMXBeanReturns the rejected task count, if available.- Specified by:
getRejectedTaskCountin interfaceThreadExecutorStatsMXBean
-
toThreadExecutorStats
public ThreadExecutorStats toThreadExecutorStats()
Returns aThreadExecutorStatsinstance containing a snapshot of the statistic metrics.
-
-