public synchronized void publishNotification(final DOMNotification notification) { for (final DOMNotificationListener domNotificationListener : listeners.get(notification.getType())) { domNotificationListener.onNotification(notification); } }
void deliverNotification() { LOG.trace("Start delivery of notification {}", notification); for (ListenerRegistration<? extends DOMNotificationListener> r : subscribers) { final DOMNotificationListener listener = r.getInstance(); if (listener != null) { try { LOG.trace("Notifying listener {}", listener); listener.onNotification(notification); LOG.trace("Listener notification completed"); } catch (Exception e) { LOG.error("Delivery of notification {} caused an error in listener {}", notification, listener, e); } } } LOG.trace("Delivery completed"); }
@Override public <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener, final Collection<SchemaPath> types) { final ListenerRegistration<org.opendaylight.mdsal.dom.api.DOMNotificationListener> reg = delegate().registerNotificationListener(notification -> { if (notification instanceof DOMNotification) { listener.onNotification((DOMNotification)notification); return; } if (notification instanceof org.opendaylight.mdsal.dom.api.DOMEvent) { listener.onNotification(new DefaultDOMEvent(notification, (org.opendaylight.mdsal.dom.api.DOMEvent)notification)); return; } listener.onNotification(new DefaultDOMNotification(notification)); }, types); return new AbstractListenerRegistration<T>(listener) { @Override protected void removeRegistration() { reg.close(); } }; }
private void publishNotification(EventSourceStatus eventSourceStatus) { final EventSourceStatusNotification notification = new EventSourceStatusNotificationBuilder() .setStatus(eventSourceStatus).build(); domNotificationListener.onNotification(createNotification(notification)); }