MessageSpy should not be generic 97/20597/2
authorRobert Varga <rovarga@cisco.com>
Sat, 16 May 2015 15:46:50 +0000 (17:46 +0200)
committerRobert Varga <rovarga@cisco.com>
Sat, 16 May 2015 16:19:25 +0000 (18:19 +0200)
This reduces the amount of warnings and confusion around when the actual
argument should be.

Change-Id: I614f2ba44f8432e3be3f3fd79c37f5d95f87fd76
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageIntelligenceAgency.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageSpy.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ThrottledNotificationsOffererImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java

index 48c500ad89a768affad3c32b694d725540a1891b..d4ef778e5d06083a549ac7c5995156a123a62389 100644 (file)
@@ -13,7 +13,7 @@ import java.util.List;
 /**
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 20.4.2015.
  */
-public interface MessageIntelligenceAgency<M> extends MessageSpy<M> {
+public interface MessageIntelligenceAgency extends MessageSpy {
 
     List<String> provideIntelligence();
 }
index 06961bd086fa74eaf8bea010efd82e8be87aa8a9..e8a102263c35ee4d2c1025389b34799a17167ed1 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific;
 /**
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 20.4.2015.
  */
-public interface MessageSpy<M> extends Runnable {
+public interface MessageSpy extends Runnable {
 
     /**
      * statistic groups overall in OFPlugin
@@ -89,5 +89,5 @@ public interface MessageSpy<M> extends Runnable {
      * @param message   from switch or to switch - depends on statGroup
      * @param statGroup
      */
-    void spyMessage(M message, STATISTIC_GROUP statGroup);
+    void spyMessage(Class<?> message, STATISTIC_GROUP statGroup);
 }
index ee586fdbc2b35116e77720703e825c023b368b4f..85403b8024c56be6efeb0bbd51d2fdfe7d2c4c4a 100644 (file)
@@ -33,7 +33,7 @@ public class ThrottledNotificationsOffererImpl<T extends Notification> implement
     private final Map<Queue<T>, SettableFuture<Void>> throttledQueues = new ConcurrentHashMap<>();
     private final ThreadPoolLoggingExecutor throttleWorkerPool;
     private final NotificationPublishService notificationPublishService;
-    private final MessageSpy<Class<?>> messageIntelligenceAgency;
+    private final MessageSpy messageIntelligenceAgency;
     private boolean finishing = false;
     private CountDownLatch sleeperLatch = new CountDownLatch(0);
 
@@ -41,7 +41,7 @@ public class ThrottledNotificationsOffererImpl<T extends Notification> implement
      * @param notificationPublishService
      * @param messageIntelligenceAgency
      */
-    public ThrottledNotificationsOffererImpl(final NotificationPublishService notificationPublishService, final MessageSpy<Class<?>> messageIntelligenceAgency) {
+    public ThrottledNotificationsOffererImpl(final NotificationPublishService notificationPublishService, final MessageSpy messageIntelligenceAgency) {
         this.notificationPublishService = notificationPublishService;
         this.messageIntelligenceAgency = messageIntelligenceAgency;
         throttleWorkerPool = new ThreadPoolLoggingExecutor(
index c19041aaeaac196cc7bc9d718422218d3681999f..fe3a17022063d3adbd6a494a80d9b31bc4558b0a 100644 (file)
@@ -109,7 +109,7 @@ public class DeviceContextImpl implements DeviceContext {
     private final DeviceMeterRegistry deviceMeterRegistry;
     private Timeout barrierTaskTimeout;
     private NotificationService notificationService;
-    private final MessageSpy<Class<?>> messageSpy;
+    private final MessageSpy messageSpy;
     private DeviceDisconnectedHandler deviceDisconnectedHandler;
     private final Collection<DeviceContextClosedHandler> closeHandlers = new HashSet<>();
     private NotificationPublishService notificationPublishService;
index 9a7a761403c55a7de1ba0980467d7a3a1a0a685b..098ef6faeb3118335845eaabd50aaf48dcbd0e66 100644 (file)
@@ -26,12 +26,13 @@ import org.slf4j.LoggerFactory;
  * Class counts message of {@link org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.STATISTIC_GROUP} type
  * and provides info as debug log.
  */
-public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency<Class<?>>, MessageIntelligenceAgencyMXBean {
+public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, MessageIntelligenceAgencyMXBean {
 
     private static final Logger LOG = LoggerFactory.getLogger(MessageIntelligenceAgencyImpl.class);
 
     private static final class MessageCounters {
         private static final AtomicLongFieldUpdater<MessageCounters> UPDATER = AtomicLongFieldUpdater.newUpdater(MessageCounters.class, "current");
+        @SuppressWarnings("unused")
         private volatile long current;
         private long cumulative;
 
@@ -54,7 +55,7 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency<
 
     @Override
     public void spyMessage(@Nonnull final Class<?> message, final STATISTIC_GROUP statGroup) {
-        Preconditions.checkNotNull(message,"Message can't be null.");
+        Preconditions.checkNotNull(message, "Message can't be null.");
         getCounters(message, statGroup).increment();
     }