簡體   English   中英

JMX-Spring-何時廣播“ JMXNotification”?

[英]JMX-Spring - When is a 'JMXNotification' broadcasted?

我正在閱讀有關JMXSpring 文檔 ,並遇到了以下段落:

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公開屬性的值時?

請幫助我知道這一點。

謝謝!

也許為時已晚..但是由於這個問題沒有被接受的答案,我將發布答案。

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

我想這個問題與Spring本身無關。 如果我正確理解的話,這里的通知就是javax.management.Notification對象

我沒有看過它,但乍看之下, 本文似乎以相當廣泛的方式涵蓋了該主題。

而且,正如您所看到的,屬性更改是廣播通知時的事件之一。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM