Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fixed major sonar warnings in Binding Aware Broker
[controller.git]
/
opendaylight
/
md-sal
/
sal-binding-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
binding
/
impl
/
NotificationBrokerImpl.xtend
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 887ef82ca90c459d6ed4e8d12bc7c52903442919..cf339ee4f474e032ff8aca805f58eb5fe1f97d3b 100644
(file)
--- 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
@@
-24,19
+24,13
@@
import java.util.Collections
import org.slf4j.LoggerFactory
import java.util.concurrent.Callable
import org.slf4j.LoggerFactory
import java.util.concurrent.Callable
-class NotificationBrokerImpl implements NotificationProviderService {
+class NotificationBrokerImpl implements NotificationProviderService
, AutoCloseable
{
val Multimap<Class<? extends Notification>, NotificationListener<?>> listeners;
@Property
var ExecutorService executor;
val Multimap<Class<? extends Notification>, NotificationListener<?>> listeners;
@Property
var ExecutorService executor;
- @Property
- var RuntimeCodeGenerator generator;
-
- @Property
- var NotificationInvokerFactory invokerFactory;
-
new(ExecutorService executor) {
listeners = HashMultimap.create()
this.executor = executor;
new(ExecutorService executor) {
listeners = HashMultimap.create()
this.executor = executor;
@@
-108,7
+102,7
@@
class NotificationBrokerImpl implements NotificationProviderService {
override registerNotificationListener(
org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
override registerNotificationListener(
org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
- val invoker = invokerFactory.invokerFor(listener);
+ val invoker =
BindingAwareBrokerImpl.generator.
invokerFactory.invokerFor(listener);
for (notifyType : invoker.supportedNotifications) {
listeners.put(notifyType, invoker.invocationProxy)
}
for (notifyType : invoker.supportedNotifications) {
listeners.put(notifyType, invoker.invocationProxy)
}
@@
-125,6
+119,11
@@
class NotificationBrokerImpl implements NotificationProviderService {
listeners.remove(notifyType, reg.invoker.invocationProxy)
}
}
listeners.remove(notifyType, reg.invoker.invocationProxy)
}
}
+
+ override close() {
+ //FIXME: implement properly.
+ }
+
}
class GenericNotificationRegistration<T extends Notification> extends AbstractObjectRegistration<NotificationListener<T>> implements ListenerRegistration<NotificationListener<T>> {
}
class GenericNotificationRegistration<T extends Notification> extends AbstractObjectRegistration<NotificationListener<T>> implements ListenerRegistration<NotificationListener<T>> {
@@
-177,7
+176,9
@@
class NotifyTask implements Callable<Object> {
override call() {
try {
override call() {
try {
+ log.info("Delivering notification {} to {}",notification,listener);
listener.onNotification(notification);
listener.onNotification(notification);
+ log.info("Notification delivered {} to {}",notification,listener);
} catch (Exception e) {
log.error("Unhandled exception thrown by listener: {}", listener, e);
}
} catch (Exception e) {
log.error("Unhandled exception thrown by listener: {}", listener, e);
}