20.3.1 监听通知
package com.habuma.spittr.jmx;
import javax.management.Notification;
import javax.management.NotificationListener;
public class PagingNotificationListener implements NotificationListener {
public void handleNotification(Notification notification, Object handback) {
// ...
}
}@Bean
public MBeanExporter mbeanExporter() {
MBeanExporter exporter = new MBeanExporter();
Map<?, NotificationListener> mappings = new HashMap<?, NotificationListener>();
mappings.put("Spitter:name=PagingNotificationListener", new PagingNotificationListener());
exporter.setNotificationListenerMappings(mappings);
return exporter;
}Last updated