Suppress FindBugs concurrency warning which is wrong 22/66122/1
authorMichael Vorburger <vorburger@redhat.com>
Thu, 30 Nov 2017 22:55:39 +0000 (23:55 +0100)
committerMichael Vorburger <vorburger@redhat.com>
Thu, 30 Nov 2017 22:55:39 +0000 (23:55 +0100)
Change-Id: Icc83aef349ce1c16ce774c1aebfa108a7718c4bd
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/EventsTimeCounter.java

index 6b5ea80e99df18361305c39c4d245c4bc5a2807b..0c603b0cca37c6e49b7b5463c12268dcaa7995db 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.ofpspecific;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -84,6 +85,7 @@ public final class EventsTimeCounter {
             delta = System.nanoTime();
         }
 
+        @SuppressFBWarnings("VO_VOLATILE_INCREMENT") // counter++ is volatile, but this is synchronized, so OK
         public synchronized void markEnd() {
             if (0 == delta) {
                 return;
@@ -97,7 +99,7 @@ public final class EventsTimeCounter {
             if (delta > maximum) {
                 maximum = delta;
             }
-            if (average > 0 && delta > (average * 1.8)) {
+            if (average > 0 && delta > average * 1.8) {
                 summary += average;
             } else {
                 summary += delta;