Bump odlparent to 6.0.0
[netconf.git] / netconf / mdsal-netconf-notification / src / main / java / org / opendaylight / netconf / mdsal / notification / impl / NetconfNotificationManager.java
index d9d18e008c3d740dddf220f7d65a397c218906a7..10b3f3ed760aa3af81a1ea7d00b1095c72db9092 100644 (file)
@@ -7,18 +7,21 @@
  */
 package org.opendaylight.netconf.mdsal.notification.impl;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.HashMultiset;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multiset;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import javax.annotation.concurrent.GuardedBy;
-import javax.annotation.concurrent.ThreadSafe;
+import org.checkerframework.checker.lock.qual.GuardedBy;
 import org.opendaylight.netconf.mdsal.notification.impl.ops.NotificationsTransformUtil;
 import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration;
 import org.opendaylight.netconf.notifications.NetconfNotification;
@@ -42,7 +45,9 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@ThreadSafe
+/**
+ *  A thread-safe implementation NetconfNotificationRegistry.
+ */
 public class NetconfNotificationManager implements NetconfNotificationCollector, NetconfNotificationRegistry,
         NetconfNotificationListener, AutoCloseable {
 
@@ -97,8 +102,8 @@ public class NetconfNotificationManager implements NetconfNotificationCollector,
     public synchronized NotificationListenerRegistration registerNotificationListener(
             final StreamNameType stream,
             final NetconfNotificationListener listener) {
-        Preconditions.checkNotNull(stream);
-        Preconditions.checkNotNull(listener);
+        requireNonNull(stream);
+        requireNonNull(listener);
 
         LOG.trace("Notification listener registered for stream: {}", stream);
 
@@ -164,8 +169,7 @@ public class NetconfNotificationManager implements NetconfNotificationCollector,
 
     @Override
     public synchronized NotificationPublisherRegistration registerNotificationPublisher(final Stream stream) {
-        Preconditions.checkNotNull(stream);
-        final StreamNameType streamName = stream.getName();
+        final StreamNameType streamName = requireNonNull(stream).getName();
 
         LOG.debug("Notification publisher registered for stream: {}", streamName);
         if (LOG.isTraceEnabled()) {
@@ -197,6 +201,8 @@ public class NetconfNotificationManager implements NetconfNotificationCollector,
         return genericNotificationPublisherReg;
     }
 
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private void unregisterNotificationPublisher(
             final StreamNameType streamName,
             final GenericNotificationPublisherReg genericNotificationPublisherReg) {
@@ -250,8 +256,8 @@ public class NetconfNotificationManager implements NetconfNotificationCollector,
 
         @Override
         public void onNotification(final StreamNameType stream, final NetconfNotification notification) {
-            Preconditions.checkState(baseListener != null, "Already closed");
-            Preconditions.checkArgument(stream.equals(registeredStream));
+            checkState(baseListener != null, "Already closed");
+            checkArgument(stream.equals(registeredStream));
             baseListener.onNotification(stream, notification);
         }
     }