JavaTM 2 Platform
Standard Ed. 6

javax.management.monitor
类 CounterMonitor

java.lang.Object
  继承者 javax.management.NotificationBroadcasterSupport
      继承者 javax.management.monitor.Monitor
          继承者 javax.management.monitor.CounterMonitor
所有已实现的接口:
MBeanRegistration, CounterMonitorMBean, MonitorMBean, NotificationBroadcaster, NotificationEmitter

public class CounterMonitor
extends Monitor
implements CounterMonitorMBean

定义专门用来观察计数器属性值的监视器 MBean。

当计数器的值达到或超过已知比较级别阈值时,计数器监视器将发送一个阈值通知。必须将通知标志设置为 true

另外,偏移量机制支持对特定计数区间的检测。如果偏移量值不为零,则每当计数器值达到比较级别而触发该阈值时,比较级别都将递增该偏移量值。这是在瞬间完成的,即在增加计数前完成。因此,对于每个级别,每当计数增加的区间等于偏移值时,阈值都将触发一个事件通知。

如果计数器能够包含其最大值,则必须指定模。模是将计数器重置为零时的值。

如果使用了计数器差分模式,则派生的尺度值将被视为两次连续观察到的计数器值之间的差分。如果此差分为负值,则派生的尺度值将增加该模的值。派生的尺度值 (V[t]) 是使用以下方法计算的:

计数器监视器的这一实现要求 observed 属性的类型为整数(ByteIntegerShortLong)。

从以下版本开始:
1.5

字段摘要
 
从类 javax.management.monitor.Monitor 继承的字段
alreadyNotified, alreadyNotifieds, capacityIncrement, dbgTag, elementCount, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, OBSERVED_OBJECT_ERROR_NOTIFIED, RESET_FLAGS_ALREADY_NOTIFIED, RUNTIME_ERROR_NOTIFIED, server
 
构造方法摘要
CounterMonitor()
          默认的构造方法。
 
方法摘要
 Number getDerivedGauge()
          已过时。 从 JMX 1.2 开始,由 getDerivedGauge(ObjectName) 取代
 Number getDerivedGauge(ObjectName object)
          如果指定的对象包含在所观察的 MBeans 集中,则获取此对象派生的尺度,否则将为 null
 long getDerivedGaugeTimeStamp()
          已过时。 从 JMX 1.2 开始,由 getDerivedGaugeTimeStamp(ObjectName) 取代
 long getDerivedGaugeTimeStamp(ObjectName object)
          如果指定的对象包含在所观察的 MBeans 集中,则获取此对象的派生尺度的时间戳,否则将为 0
 boolean getDifferenceMode()
          获取所有观察到的 MBeans 的共同的差分模式标志值。
 Number getInitThreshold()
          获取所有观察对象的公共初始阈值。
 Number getModulus()
          获取所有观察到的 MBeans 共同的模值。
 MBeanNotificationInfo[] getNotificationInfo()
          返回一个 NotificationInfo 对象,它包含通知的 Java 类的名称和由计数器监视器发送的通知类型。
 boolean getNotify()
          获取所有观察到的 MBeans 共同的通知的开/关切换值。
 Number getOffset()
          获取所有观察到的 MBeans 共同的偏移量值。
 Number getThreshold()
          已过时。 从 JMX 1.2 开始,由 getThreshold(ObjectName) 取代
 Number getThreshold(ObjectName object)
          如果指定的对象包含在观察到的 MBeans 集中,则获取指定对象的当前阈值,否则将为 null
 void setDifferenceMode(boolean value)
          设置所有观察到的 MBeans 的共同的差分模式标志值。
 void setInitThreshold(Number value)
          设置所有观察对象的共同初始阈值。
 void setModulus(Number value)
          设置所有观察到的 MBeans 共同的模值。
 void setNotify(boolean value)
          设置所有观察到的 MBeans 共同的通知的开/关切换值。
 void setOffset(Number value)
          设置所有观察到的 MBeans 共同的偏移量值。
 void setThreshold(Number value)
          已过时。 从 JMX 1.2 开始,由 setInitThreshold(java.lang.Number) 取代
 void start()
          启动计数器监视器。
 void stop()
          停止计数器监视器。
 
从类 javax.management.monitor.Monitor 继承的方法
addObservedObject, containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObject, getObservedObjects, isActive, postDeregister, postRegister, preDeregister, preRegister, removeObservedObject, setGranularityPeriod, setObservedAttribute, setObservedObject
 
从类 javax.management.NotificationBroadcasterSupport 继承的方法
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 javax.management.monitor.MonitorMBean 继承的方法
addObservedObject, containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObject, getObservedObjects, isActive, removeObservedObject, setGranularityPeriod, setObservedAttribute, setObservedObject
 

构造方法详细信息

CounterMonitor

public CounterMonitor()
默认的构造方法。

方法详细信息

start

public void start()
启动计数器监视器。

指定者:
接口 MonitorMBean 中的 start
指定者:
Monitor 中的 start

stop

public void stop()
停止计数器监视器。

指定者:
接口 MonitorMBean 中的 stop
指定者:
Monitor 中的 stop

getDerivedGauge

public Number getDerivedGauge(ObjectName object)
如果指定的对象包含在所观察的 MBeans 集中,则获取此对象派生的尺度,否则将为 null

指定者:
接口 CounterMonitorMBean 中的 getDerivedGauge
参数:
object - 将返回其派生尺度的对象的名称。
返回:
指定对象的派生尺度。

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp(ObjectName object)
如果指定的对象包含在所观察的 MBeans 集中,则获取此对象的派生尺度的时间戳,否则将为 0

指定者:
接口 CounterMonitorMBean 中的 getDerivedGaugeTimeStamp
参数:
object - 将返回其派生尺度时间戳的对象的名称。
返回:
指定对象的派生尺度时间戳。

getThreshold

public Number getThreshold(ObjectName object)
如果指定的对象包含在观察到的 MBeans 集中,则获取指定对象的当前阈值,否则将为 null

指定者:
接口 CounterMonitorMBean 中的 getThreshold
参数:
object - 将返回其阈值的对象的名称。
返回:
指定对象的阈值。
另请参见:
CounterMonitorMBean.setThreshold(java.lang.Number)

getInitThreshold

public Number getInitThreshold()
获取所有观察对象的公共初始阈值。

指定者:
接口 CounterMonitorMBean 中的 getInitThreshold
返回:
初始阈值。
另请参见:
setInitThreshold(java.lang.Number)

setInitThreshold

public void setInitThreshold(Number value)
                      throws IllegalArgumentException
设置所有观察对象的共同初始阈值。
所观察 MBeans 集中每个对象的当前阈值都将因此得到更新。

指定者:
接口 CounterMonitorMBean 中的 setInitThreshold
参数:
value - 初始阈值。
抛出:
IllegalArgumentException - 指定的阈值为 null,或者阈值小于零。
另请参见:
getInitThreshold()

getDerivedGauge

@Deprecated
public Number getDerivedGauge()
已过时。 从 JMX 1.2 开始,由 getDerivedGauge(ObjectName) 取代

返回所观察 MBeans 集中第一个对象的派生尺度。

指定者:
接口 CounterMonitorMBean 中的 getDerivedGauge
返回:
派生的尺度。

getDerivedGaugeTimeStamp

@Deprecated
public long getDerivedGaugeTimeStamp()
已过时。 从 JMX 1.2 开始,由 getDerivedGaugeTimeStamp(ObjectName) 取代

获取所观察 MBeans 集中第一个对象的派生尺度时间戳。

指定者:
接口 CounterMonitorMBean 中的 getDerivedGaugeTimeStamp
返回:
派生的尺度时间戳。

getThreshold

@Deprecated
public Number getThreshold()
已过时。 从 JMX 1.2 开始,由 getThreshold(ObjectName) 取代

返回所观察 MBeans 集中第一个对象的阈值。

指定者:
接口 CounterMonitorMBean 中的 getThreshold
返回:
阈值。
另请参见:
setThreshold(java.lang.Number)

setThreshold

@Deprecated
public void setThreshold(Number value)
                  throws IllegalArgumentException
已过时。 从 JMX 1.2 开始,由 setInitThreshold(java.lang.Number) 取代

设置初始阈值。

指定者:
接口 CounterMonitorMBean 中的 setThreshold
参数:
value - 初始阈值。
抛出:
IllegalArgumentException - 指定的阈值为 null,或者该阈值小于零。
另请参见:
getThreshold()

getOffset

public Number getOffset()
获取所有观察到的 MBeans 共同的偏移量值。

指定者:
接口 CounterMonitorMBean 中的 getOffset
返回:
偏移量值。
另请参见:
setOffset(java.lang.Number)

setOffset

public void setOffset(Number value)
               throws IllegalArgumentException
设置所有观察到的 MBeans 共同的偏移量值。

指定者:
接口 CounterMonitorMBean 中的 setOffset
参数:
value - 偏移量值。
抛出:
IllegalArgumentException - 指定的偏移量值为 null,或者该偏移量值小于零。
另请参见:
getOffset()

getModulus

public Number getModulus()
获取所有观察到的 MBeans 共同的模值。

指定者:
接口 CounterMonitorMBean 中的 getModulus
返回:
模值。
另请参见:
setModulus(java.lang.Number)

setModulus

public void setModulus(Number value)
                throws IllegalArgumentException
设置所有观察到的 MBeans 共同的模值。

指定者:
接口 CounterMonitorMBean 中的 setModulus
参数:
value - 模值。
抛出:
IllegalArgumentException - 指定的模为 null,或者该模小于零。
另请参见:
getModulus()

getNotify

public boolean getNotify()
获取所有观察到的 MBeans 共同的通知的开/关切换值。

指定者:
接口 CounterMonitorMBean 中的 getNotify
返回:
如果超出阈值时计数器监视器发出通知,则返回 true,否则返回 false
另请参见:
setNotify(boolean)

setNotify

public void setNotify(boolean value)
设置所有观察到的 MBeans 共同的通知的开/关切换值。

指定者:
接口 CounterMonitorMBean 中的 setNotify
参数:
value - 通知的开/关切换值。
另请参见:
getNotify()

getDifferenceMode

public boolean getDifferenceMode()
获取所有观察到的 MBeans 的共同的差分模式标志值。

指定者:
接口 CounterMonitorMBean 中的 getDifferenceMode
返回:
如果使用了差分模式,则返回 true;否则返回 false
另请参见:
setDifferenceMode(boolean)

setDifferenceMode

public void setDifferenceMode(boolean value)
设置所有观察到的 MBeans 的共同的差分模式标志值。

指定者:
接口 CounterMonitorMBean 中的 setDifferenceMode
参数:
value - 差分模式标志值。
另请参见:
getDifferenceMode()

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
返回一个 NotificationInfo 对象,它包含通知的 Java 类的名称和由计数器监视器发送的通知类型。

指定者:
接口 NotificationBroadcaster 中的 getNotificationInfo
覆盖:
NotificationBroadcasterSupport 中的 getNotificationInfo
返回:
可能的通知数组。

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only