类 AttributeChangeNotification

java.lang.Object
java.util.EventObject
javax.management.Notification
javax.management.AttributeChangeNotification
所有已实现的接口:
Serializable

public class AttributeChangeNotification extends Notification
提供由 MBean 发送的属性更改通知的定义。

当属性更改发生时,由拥有相关属性的 MBean 来创建和发送属性更改通知。因此 NotificationBroadcaster 接口必须由任何对其属性更改感兴趣的 MBean 实现。

示例:如果名为 myMbean 的 MBean 在其属性为:

String myString
修改后,myMbean 创建并发出以下通知:
new AttributeChangeNotification(myMbean, sequenceNumber, timeStamp, msg, "myString", "String", oldValue, newValue);
自从:
1.5
参见:
  • 字段详细信息

    • ATTRIBUTE_CHANGE

      public static final String  ATTRIBUTE_CHANGE
      指示观察到的 MBean 属性值已更改的通知类型。
      此类型字符串的值为 jmx.attribute.change
      参见:
  • 构造方法详细信息

    • AttributeChangeNotification

      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 - 表示更改后属性值的对象。
  • 方法详情

    • getAttributeName

      public String  getAttributeName()
      获取已更改的属性的名称。
      返回:
      包含属性名称的字符串。
    • getAttributeType

      public String  getAttributeType()
      获取已更改的属性的类型。
      返回:
      包含属性类型的字符串。
    • getOldValue

      public Object  getOldValue()
      获取已更改的属性的旧值。
      返回:
      包含属性旧值的对象。
    • getNewValue

      public Object  getNewValue()
      获取已更改的属性的新值。
      返回:
      包含属性新值的对象。