java.lang.Objectjava.util.EventObject
javax.management.Notification
javax.management.AttributeChangeNotification
public class AttributeChangeNotification
提供 MBean 所发送的属性更改通知的定义。
当属性发生更改时,由拥有相关属性的 MBean 负责创建并发送属性更改通知。所以必须由发生属性更改的 MBean 来实现 NotificationBroadcaster 接口。
示例:如果一个称为 myMbean 的 MBean 在其属性
String myString
被修改时通知已注册的侦听器,则
myMbean 创建并忽略以下通知:
new AttributeChangeNotification(myMbean, sequenceNumber, timeStamp, msg, "myString", "String", oldValue, newValue);
| 字段摘要 | |
|---|---|
static String |
ATTRIBUTE_CHANGE 通知类型,指示所观察的 MBean 属性值已更改。 |
| 从类 javax.management.Notification 继承的字段 |
|---|
source |
| 构造方法摘要 | |
|---|---|
AttributeChangeNotification(Object source, long sequenceNumber, long timeStamp, String msg, String attributeName, String attributeType, Object oldValue, Object newValue) 构造一个 AttributeChangeNotification 对象。 |
|
| 方法摘要 | |
|---|---|
String |
getAttributeName() 获得已更改属性的名称。 |
String |
getAttributeType() 获得已更改属性的类型。 |
Object |
getNewValue() 获得已更改属性的新值。 |
Object |
getOldValue() 获得已更改属性的旧值。 |
| 从类 javax.management.Notification 继承的方法 |
|---|
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData, toString |
| 从类 java.util.EventObject 继承的方法 |
|---|
getSource |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
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 - 包含通知消息的 String。
attributeName - 提供属性名称的 String。
attributeType - 包含属性类型的 String。
oldValue - 表示更改属性前该属性值的对象。
newValue - 表示更改属性后该属性值的对象。
| 方法详细信息 |
|---|
public String getAttributeName()
public String getAttributeType()
public Object getOldValue()
public Object getNewValue()