use of org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener in project controller by opendaylight.
the class DOMNotificationRouter method registerNotificationListener.
@Override
public synchronized <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener, final Collection<SchemaPath> types) {
final ListenerRegistration<T> reg = new AbstractListenerRegistration<T>(listener) {
@Override
protected void removeRegistration() {
final ListenerRegistration<T> me = this;
synchronized (DOMNotificationRouter.this) {
replaceListeners(ImmutableMultimap.copyOf(Multimaps.filterValues(listeners, input -> input != me)));
}
}
};
if (!types.isEmpty()) {
final Builder<SchemaPath, ListenerRegistration<? extends DOMNotificationListener>> b = ImmutableMultimap.builder();
b.putAll(listeners);
for (final SchemaPath t : types) {
b.put(t, reg);
}
replaceListeners(b.build());
}
return reg;
}
use of org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener in project controller by opendaylight.
the class DOMNotificationRouterEvent method deliverNotification.
void deliverNotification() {
LOG.trace("Start delivery of notification {}", notification);
for (ListenerRegistration<? extends DOMNotificationListener> r : subscribers) {
final DOMNotificationListener listener = r.getInstance();
LOG.trace("Notifying listener {}", listener);
listener.onNotification(notification);
LOG.trace("Listener notification completed");
}
LOG.trace("Delivery completed");
}
Aggregations