Fix modernization issues
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / DOMNotificationRouterEvent.java
index 9bf0e2adb64eaf19ca2543e814b6c5655364c381..47ff2c286958edacf8f6519bc355c5e2ef1c38a3 100644 (file)
@@ -7,10 +7,12 @@
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 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;
@@ -22,6 +24,7 @@ import org.slf4j.LoggerFactory;
  * A single notification event in the disruptor ringbuffer. These objects are reused,
  * so they do have mutable state.
  */
+@Deprecated
 final class DOMNotificationRouterEvent {
     private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationRouterEvent.class);
     public static final EventFactory<DOMNotificationRouterEvent> FACTORY = DOMNotificationRouterEvent::new;
@@ -34,11 +37,12 @@ final class DOMNotificationRouterEvent {
         // Hidden on purpose, initialized in initialize()
     }
 
+    @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.notification = requireNonNull(notification);
+        this.subscribers = requireNonNull(subscribers);
         this.future = SettableFuture.create();
         return this.future;
     }
@@ -47,19 +51,18 @@ final class DOMNotificationRouterEvent {
         LOG.trace("Start delivery of notification {}", notification);
         for (ListenerRegistration<? extends DOMNotificationListener> r : subscribers) {
             final DOMNotificationListener listener = r.getInstance();
-            if (listener != null) {
-                LOG.trace("Notifying listener {}", listener);
-                listener.onNotification(notification);
-                LOG.trace("Listener notification completed");
-            }
+            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);
         notification = null;
         subscribers = null;
         future = null;
     }
-}
\ No newline at end of file
+}