Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Remove DataChangeListener and friends
[controller.git]
/
opendaylight
/
md-sal
/
sal-dom-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
md
/
sal
/
dom
/
broker
/
impl
/
DOMNotificationRouterEvent.java
diff --git
a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java
b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java
index 65c7166ac97c2eebf82e9ebaba85c17368319bcf..1aa52ea6137995d361255224df1917cde922b985 100644
(file)
--- a/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java
+++ b/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java
@@
-11,22
+11,21
@@
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.lmax.disruptor.EventFactory;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.lmax.disruptor.EventFactory;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import java.util.Collection;
import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A single notification event in the disruptor ringbuffer. These objects are reused,
* so they do have mutable state.
*/
final class DOMNotificationRouterEvent {
/**
* A single notification event in the disruptor ringbuffer. These objects are reused,
* so they do have mutable state.
*/
final class DOMNotificationRouterEvent {
- public static final EventFactory<DOMNotificationRouterEvent> FACTORY = new EventFactory<DOMNotificationRouterEvent>() {
- @Override
- public DOMNotificationRouterEvent newInstance() {
- return new DOMNotificationRouterEvent();
- }
- };
+ private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationRouterEvent.class);
+ public static final EventFactory<DOMNotificationRouterEvent> FACTORY = DOMNotificationRouterEvent::new;
private Collection<ListenerRegistration<? extends DOMNotificationListener>> subscribers;
private DOMNotification notification;
private Collection<ListenerRegistration<? extends DOMNotificationListener>> subscribers;
private DOMNotification notification;
@@
-36,7
+35,10
@@
final class DOMNotificationRouterEvent {
// Hidden on purpose, initialized in initialize()
}
// Hidden on purpose, initialized in initialize()
}
- ListenableFuture<Void> initialize(final DOMNotification notification, final Collection<ListenerRegistration<? extends DOMNotificationListener>> subscribers) {
+ @SuppressWarnings("checkstyle:hiddenField")
+ ListenableFuture<Void> initialize(final DOMNotification notification,
+ final Collection<ListenerRegistration<? extends DOMNotificationListener>>
+ subscribers) {
this.notification = Preconditions.checkNotNull(notification);
this.subscribers = Preconditions.checkNotNull(subscribers);
this.future = SettableFuture.create();
this.notification = Preconditions.checkNotNull(notification);
this.subscribers = Preconditions.checkNotNull(subscribers);
this.future = SettableFuture.create();
@@
-44,16
+46,21
@@
final class DOMNotificationRouterEvent {
}
void deliverNotification() {
}
void deliverNotification() {
+ LOG.trace("Start delivery of notification {}", notification);
for (ListenerRegistration<? extends DOMNotificationListener> r : subscribers) {
for (ListenerRegistration<? extends DOMNotificationListener> r : subscribers) {
- final DOMNotificationListener l = r.getInstance();
- if (l != null) {
-
l
.onNotification(notification);
- }
+ final DOMNotificationListener l
istener
= r.getInstance();
+ LOG.trace("Notifying listener {}", listener);
+
listener
.onNotification(notification);
+ LOG.trace("Listener notification completed");
}
}
+ LOG.trace("Delivery completed");
}
}
+ @SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "Void is the only allowed value")
void setFuture() {
future.set(null);
void setFuture() {
future.set(null);
+ notification = null;
+ subscribers = null;
+ future = null;
}
}
-
-}
\ No newline at end of file
+}