Java JMX Spring-何时是';JMXNotification';广播?
我在查看Java JMX Spring-何时是';JMXNotification';广播?,java,spring,notifications,jmx,Java,Spring,Notifications,Jmx,我在查看JMX上的Spring时,遇到了以下段落: 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 noti
JMX
上的Spring
时,遇到了以下段落:
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.
这就是控制台LoggingNotificationListener
的实现方式:
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通知何时广播?是在JMX暴露属性的值更改时发生的吗
请帮我知道这件事
谢谢 我想这个问题与春天本身无关。如果我理解正确,这里的通知是
我没有读过,但乍一看似乎涵盖了相当广泛的主题
正如您所看到的,属性更改是广播通知时发生的事件之一。可能有点太晚了。。然而,由于这个问题没有被接受的答案,我将发布我的答案
Spring文档还说:
Spring的JMX通知发布支持中的关键接口是NotificationPublisher接口(在org.springframework.JMX.export.notification包中定义)。任何将通过MBeanExporter实例导出为MBean的bean都可以实现相关的NotificationPublisherWare接口,以获得对NotificationPublisher实例的访问权。
你要找的答案在上面摘录的最后一句话中
参考: