Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Fix for bug #236 and bug #240 Have made changes in opendaylight-table-types...
[controller.git]
/
opendaylight
/
md-sal
/
sal-dom-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
dom
/
broker
/
impl
/
NotificationRouterImpl.java
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 6d7b600dbcb3a4b68377cdec27a3314e24df6812..0b184fc86ec0720193210bd8b0a997235caddca8 100644
(file)
--- 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
@@
-34,19
+34,21
@@
import org.slf4j.LoggerFactory;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
public class NotificationRouterImpl implements NotificationRouter {
private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class);
public class NotificationRouterImpl implements NotificationRouter {
private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class);
- private Multimap<QName, Registration<NotificationListener>> listeners = HashMultimap.create();
-
+ private Multimap<QName, Registration<NotificationListener>> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, Registration<NotificationListener>>create());
+// private Registration<NotificationListener> defaultListener;
+
private void sendNotification(CompositeNode notification) {
private void sendNotification(CompositeNode notification) {
- QName type = notification.getNodeType();
- Collection<Registration<NotificationListener>> toNotify = listeners.get(type);
- log.
info
("Publishing notification " + type);
+
final
QName type = notification.getNodeType();
+
final
Collection<Registration<NotificationListener>> 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;
}
return;
}
@@
-58,17
+60,17
@@
public class NotificationRouterImpl implements NotificationRouter {
log.error("Uncaught exception in NotificationListener", e);
}
}
log.error("Uncaught exception in NotificationListener", e);
}
}
-
}
@Override
public void publish(CompositeNode notification) {
sendNotification(notification);
}
}
@Override
public void publish(CompositeNode notification) {
sendNotification(notification);
}
-
+
@Override
public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
ListenerRegistration ret = new ListenerRegistration(notification, listener);
@Override
public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
ListenerRegistration ret = new ListenerRegistration(notification, listener);
+ listeners.put(notification, ret);
return ret;
}
return ret;
}