- java.lang.Object
-
- javax.management.NotificationBroadcasterSupport
-
- javax.management.monitor.Monitor
-
- javax.management.monitor.StringMonitor
-
- All Implemented Interfaces:
-
MBeanRegistration,MonitorMBean,StringMonitorMBean,NotificationBroadcaster,NotificationEmitter
public class StringMonitor extends Monitor implements StringMonitorMBean
定义一个监视器MBean,用于观察字符串属性的值。字符串监视器发送通知如下:
- 如果属性值与要比较值的字符串匹配,则发送一个
match notification。 通知匹配标志必须设置为true。
字符串到比较值的后续匹配不会导致进一步的通知,除非属性值与字符串比较值不同。 - 如果属性值与字符串与比较值不同,则发送
differ notification。 通知不同标志必须设置为true。
从字符串到比较值的后续差异不会导致进一步的通知,除非属性值与要比较值的字符串匹配。
- 从以下版本开始:
- 1.5
-
-
Field Summary
-
Fields inherited from class 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
-
-
构造方法摘要
构造方法 Constructor 描述 StringMonitor()默认构造函数。
-
方法摘要
所有方法 接口方法 具体的方法 弃用的方法 Modifier and Type 方法 描述 StringgetDerivedGauge()已过时。截至JMX 1.2,由getDerivedGauge(ObjectName)取代StringgetDerivedGauge(ObjectName object)如果此对象包含在观察到的MBean集合中,则获取指定对象的派生规格,否则为null。longgetDerivedGaugeTimeStamp()已过时。截至JMX 1.2,由getDerivedGaugeTimeStamp(ObjectName)替代longgetDerivedGaugeTimeStamp(ObjectName object)如果该对象包含在观察到的MBean集合中,则获取指定对象的派生量规时间戳,否则为0。MBeanNotificationInfo[]getNotificationInfo()返回一个NotificationInfo对象,该对象包含通知的Java类的名称以及字符串监视器发送的通知类型。booleangetNotifyDiffer()获取所有观察到的MBean通用的不同通知的开关值。booleangetNotifyMatch()获取匹配通知的所有观察到的MBean通用的开/关开关值。StringgetStringToCompare()获取与所有观察到的MBean共有的观察属性进行比较的字符串。voidsetNotifyDiffer(boolean value)设置所有观察到的MBean通用的不同通知的开/关开关值。voidsetNotifyMatch(boolean value)设置匹配通知的所有观察到的MBean通用的开/关开关值。voidsetStringToCompare(String value)将字符串设置为与所有观察到的MBean共有的观察属性进行比较。voidstart()启动字符串监视器。voidstop()停止字符串监视器。-
Methods inherited from class javax.management.monitor.Monitor
addObservedObject, containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObject, getObservedObjects, isActive, postDeregister, postRegister, preDeregister, preRegister, removeObservedObject, setGranularityPeriod, setObservedAttribute, setObservedObject
-
Methods inherited from interface javax.management.monitor.MonitorMBean
addObservedObject, containsObservedObject, getGranularityPeriod, getObservedAttribute, getObservedObject, getObservedObjects, isActive, removeObservedObject, setGranularityPeriod, setObservedAttribute, setObservedObject
-
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
-
-
-
-
方法详细信息
-
start
public void start()
启动字符串监视器。- Specified by:
-
start在接口MonitorMBean - Specified by:
-
start在Monitor
-
stop
public void stop()
停止字符串监视器。- Specified by:
-
stop在接口MonitorMBean - Specified by:
-
stop在Monitor
-
getDerivedGauge
public String getDerivedGauge(ObjectName object)
如果此对象包含在观察到的MBean集合中,则获取指定对象的派生规格,否则为null。- Specified by:
-
getDerivedGauge在接口StringMonitorMBean - 参数
-
object- 需要派生量规的MBean的名称。 - 结果
- 指定对象的派生量表。
-
getDerivedGaugeTimeStamp
public long getDerivedGaugeTimeStamp(ObjectName object)
如果该对象包含在观察到的MBean集合中,则获取指定对象的派生标尺时间戳,否则为0。- Specified by:
-
getDerivedGaugeTimeStamp在接口StringMonitorMBean - 参数
-
object- 要返回派生标尺时间戳的对象的名称。 - 结果
- 指定对象的派生量规时间戳。
-
getDerivedGauge
@Deprecated public String getDerivedGauge()
已过时。 截至JMX 1.2,由getDerivedGauge(ObjectName)取代返回观察到的MBean集合中第一个对象的派生规格。- Specified by:
-
getDerivedGauge在接口StringMonitorMBean - 结果
- 派生量规。
-
getDerivedGaugeTimeStamp
@Deprecated public long getDerivedGaugeTimeStamp()
已过时。 截至JMX 1.2,由getDerivedGaugeTimeStamp(ObjectName)替代获取观察到的MBean集合中第一个对象的派生标尺时间戳。- Specified by:
-
getDerivedGaugeTimeStamp在接口StringMonitorMBean - 结果
- 派生标尺时间戳。
-
getStringToCompare
public String getStringToCompare()
获取与所有观察到的MBean共有的观察属性进行比较的字符串。- Specified by:
-
getStringToCompare在接口StringMonitorMBean - 结果
- 字符串值。
- 另请参见:
-
setStringToCompare(java.lang.String)
-
setStringToCompare
public void setStringToCompare(String value) throws IllegalArgumentException
将字符串设置为与所有观察到的MBean共有的观察属性进行比较。- Specified by:
-
setStringToCompare在接口StringMonitorMBean - 参数
-
value- 字符串值。 - 异常
-
IllegalArgumentException- 要比较的指定字符串为null。 - 另请参见:
-
getStringToCompare()
-
getNotifyMatch
public boolean getNotifyMatch()
获取匹配通知的所有观察到的MBean通用的开/关开关值。- Specified by:
-
getNotifyMatch在接口StringMonitorMBean - 结果
-
true如果字符串监视器在匹配要比较的字符串时通知,否则为false。 - 另请参见:
-
setNotifyMatch(boolean)
-
setNotifyMatch
public void setNotifyMatch(boolean value)
设置匹配通知的所有观察到的MBean通用的开/关开关值。- Specified by:
-
setNotifyMatch在接口StringMonitorMBean - 参数
-
value- 匹配通知的开/关开关值。 - 另请参见:
-
getNotifyMatch()
-
getNotifyDiffer
public boolean getNotifyDiffer()
获取所有观察到的MBean通用的不同通知的开关值。- Specified by:
-
getNotifyDiffer在接口StringMonitorMBean - 结果
-
true如果字符串监视器通知不同于要比较的字符串,false否则。 - 另请参见:
-
setNotifyDiffer(boolean)
-
setNotifyDiffer
public void setNotifyDiffer(boolean value)
设置所有观察到的MBean通用的不同通知的开/关开关值。- Specified by:
-
setNotifyDiffer在接口StringMonitorMBean - 参数
-
value- 不同通知的开/关开关值。 - 另请参见:
-
getNotifyDiffer()
-
getNotificationInfo
public MBeanNotificationInfo[] getNotificationInfo()
返回一个NotificationInfo对象,其中包含通知的Java类的名称以及字符串监视器发送的通知类型。- Specified by:
-
getNotificationInfo在接口NotificationBroadcaster - 重写:
-
getNotificationInfo在NotificationBroadcasterSupport - 结果
- 可能通知的数组。
-
-