X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2Fimpl%2FNotificationRouterImpl.java;h=0b184fc86ec0720193210bd8b0a997235caddca8;hb=c61d22e4dc73fdaba09aa8c0b189ea7459679e03;hp=763407f23a671476c7f47a9c8f7e3d63e0b2b128;hpb=9d02282775e0464dd2b1e3e1c14bf02729f18ee9;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java index 763407f23a..0b184fc86e 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java @@ -40,14 +40,15 @@ public class NotificationRouterImpl implements NotificationRouter { private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class); private Multimap> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.>create()); - +// private Registration defaultListener; + private void sendNotification(CompositeNode notification) { - QName type = notification.getNodeType(); - Collection> toNotify = listeners.get(type); + final QName type = notification.getNodeType(); + final Collection> toNotify = listeners.get(type); log.trace("Publishing notification " + type); - if (toNotify == null) { - // No listeners were registered - returns. + if ((toNotify == null) || toNotify.isEmpty()) { + log.debug("No listener registered for handling of notification {}", type); return; } @@ -59,17 +60,17 @@ public class NotificationRouterImpl implements NotificationRouter { log.error("Uncaught exception in NotificationListener", e); } } - } @Override public void publish(CompositeNode notification) { sendNotification(notification); } - + @Override public Registration addNotificationListener(QName notification, NotificationListener listener) { ListenerRegistration ret = new ListenerRegistration(notification, listener); + listeners.put(notification, ret); return ret; }