public class AttributeChangeNotification extends Notification
它是由MBean拥有利益的属性创建和发送属性更改通知的属性发生变化时。所以NotificationBroadcaster
接口必须由任何MBean的属性是变化的兴趣。
例如:如果一个MBean称myMbean
需要通知注册的监听器时,它的属性:
String myString
被修改,
myMbean
创建并发出通知如下:
new AttributeChangeNotification(myMbean, sequenceNumber, timeStamp, msg, "myString", "String", oldValue, newValue);
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_CHANGE
通知类型说明观察到的MBean属性值已更改。
|
source
Constructor and Description |
---|
AttributeChangeNotification(Object source, long sequenceNumber, long timeStamp, String msg, String attributeName, String attributeType, Object oldValue, Object newValue)
构造一个属性更改通知对象。
|
Modifier and Type | Method and Description |
---|---|
String |
getAttributeName()
获取已更改的属性的名称。
|
String |
getAttributeType()
获取已更改的属性的类型。
|
Object |
getNewValue()
获取已更改的属性的新值。
|
Object |
getOldValue()
获取已更改的属性的旧值。
|
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData, toString
getSource
public static final String ATTRIBUTE_CHANGE
jmx.attribute.change
public AttributeChangeNotification(Object source, long sequenceNumber, long timeStamp, String msg, String attributeName, String attributeType, Object oldValue, Object newValue)
source
-通知生产者,即MBean属性属于。
sequenceNumber
-源对象中的序列号的通知。
timeStamp
-的日期通知被发送。
msg
-字符串通知消息。
attributeName
-一个字符串的属性的名称。
attributeType
-字符串类型的属性。
oldValue
-对象代表的属性值变化前。
newValue
代表属性值更改后的对象。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.