@Override public void initialise() throws InitialisationException { Map<String, Class<? extends Notification>> eventMap = new HashMap<>(EVENT_MAP); Map<String, Class<? extends NotificationListener>> interfaceMap = new HashMap<>(INTERFACE_MAP); ServerNotificationManager notificationManager = populateNotificationTypeMappings(eventMap, interfaceMap); enableNotifications(notificationManager, eventMap, interfaceMap); disableNotifications(notificationManager, eventMap, interfaceMap); // Merge: // i) explicitly configured notification listeners, // ii) any singleton beans defined in spring that implement NotificationListener. for (ListenerSubscriptionPair sub : getMergedListeners(notificationManager)) { // Do this to avoid warnings when the Spring context is refreshed if (!notificationManager.isListenerRegistered(sub.getListener())) { notificationManager.addListenerSubscriptionPair(sub); } else { notificationManager.removeListener(sub.getListener()); notificationManager.addListenerSubscriptionPair(sub); } } }
@Override public void initialise() throws InitialisationException { Map<String, Class<? extends Notification>> eventMap = new HashMap<>(EVENT_MAP); Map<String, Class<? extends NotificationListener>> interfaceMap = new HashMap<>(INTERFACE_MAP); ServerNotificationManager notificationManager = populateNotificationTypeMappings(eventMap, interfaceMap); enableNotifications(notificationManager, eventMap, interfaceMap); disableNotifications(notificationManager, eventMap, interfaceMap); // Merge: // i) explicitly configured notification listeners, // ii) any singleton beans defined in spring that implement NotificationListener. for (ListenerSubscriptionPair sub : getMergedListeners(notificationManager)) { // Do this to avoid warnings when the Spring context is refreshed if (!notificationManager.isListenerRegistered(sub.getListener())) { notificationManager.addListenerSubscriptionPair(sub); } else { notificationManager.removeListener(sub.getListener()); notificationManager.addListenerSubscriptionPair(sub); } } }