X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FNotificationBrokerImpl.xtend;h=52aa8d029066b3093a90300f6bb078886b2b3d7b;hb=730db233aa71642f0aa8a70f30fcd5bbbbbabac9;hp=e8b3850b77b665113b3bac0d9e33c8029cc592fc;hpb=e5b6f6c1b1f677207cc7d85eeb816b3abe27297c;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend index e8b3850b77..52aa8d0290 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend @@ -21,7 +21,8 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration import org.opendaylight.yangtools.concepts.Registration import org.opendaylight.yangtools.yang.binding.Notification import org.slf4j.LoggerFactory - +import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder import com.google.common.collect.Multimaps + class NotificationBrokerImpl implements NotificationProviderService, AutoCloseable { val Multimap, NotificationListener> listeners; @@ -29,8 +30,13 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab @Property var ExecutorService executor; + new() { + listeners = Multimaps.synchronizedSetMultimap(HashMultimap.create()) + } + + @Deprecated new(ExecutorService executor) { - listeners = HashMultimap.create() + listeners = Multimaps.synchronizedSetMultimap(HashMultimap.create()) this.executor = executor; } @@ -100,7 +106,7 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab override registerNotificationListener( org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - val invoker = BindingAwareBrokerImpl.generator.invokerFactory.invokerFor(listener); + val invoker = SingletonHolder.INVOKER_FACTORY.invokerFor(listener); for (notifyType : invoker.supportedNotifications) { listeners.put(notifyType, invoker.invocationProxy) } @@ -169,14 +175,24 @@ class NotifyTask implements Callable { private static val log = LoggerFactory.getLogger(NotifyTask); + @SuppressWarnings("rawtypes") val NotificationListener listener; val Notification notification; override call() { + //Only logging the complete notification in debug mode try { - log.info("Delivering notification {} to {}",notification,listener); + if(log.isDebugEnabled){ + log.debug("Delivering notification {} to {}",notification,listener); + } else { + log.trace("Delivering notification {} to {}",notification.class.name,listener); + } listener.onNotification(notification); - log.info("Notification delivered {} to {}",notification,listener); + if(log.isDebugEnabled){ + log.debug("Notification delivered {} to {}",notification,listener); + } else { + log.trace("Notification delivered {} to {}",notification.class.name,listener); + } } catch (Exception e) { log.error("Unhandled exception thrown by listener: {}", listener, e); }