connection.addNotificationListener(monitorName, new NotificationListener() {
public void handleNotification(Notification notification, Object handback) {
System.out.println("Notification = " + notification);
synchronized (notificationSet) {
notificationSet.set(true);
notificationSet.notify();
}
}
}, null, null);
service.start();
monitorMBean.start();