2010-11-23 76 views
0

我正在经历上JMXSpringdocumentation和整个下段传来:JMX-Spring - 什么时候播出'JMXNotification'?

By configuring NotificationListeners in place, every time a JMX Notification is broadcast 
from the target MBean (bean:name=testBean1),the ConsoleLoggingNotificationListener bean 
that was registered as a listener via the notificationListenerMappings property will be 
notified. 

这是怎么ConsoleLoggingNotificationListener实现:

public class ConsoleLoggingNotificationListener 
       implements NotificationListener, NotificationFilter { 

    public void handleNotification(Notification notification, Object handback) { 
     System.out.println(notification); 
     System.out.println(handback); 
    } 

    public boolean isNotificationEnabled(Notification notification) { 
     return AttributeChangeNotification.class.isAssignableFrom(notification.getClass()); 
    } 
} 

但是,因为我是新手,我想知道什么时候播出了JMX Notification?是否当一个JMX暴露的属性的值是已更改

请帮我知道这一点。

谢谢!

回答

0

我想这个问题与Spring本身无关。如果我理解正确,这里的通知是javax.management.Notification objects

我还没看过,但乍一看this article似乎以相当广泛的方式涵盖了这个话题。

而且,正如您所看到的,属性更改是通知广播时的事件之一。

0

也许这是有点太晚..但因为这个问题没有接受的答案我会张贴我的答案。

Spring文档也说:

在Spring的JMX通知发布支持中,关键的是NotificationPublisher接口(在包org.springframework.jmx.export.notification定义)。任何要通过MBeanExporter实例导出为MBean的bean都可以实现相关的NotificationPublisherAware接口,以访问NotificationPublisher实例。

你正在寻找的答案就在上面摘录的最后一句

编号:http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch24s07.html#jmx-notifications-listeners

相关问题