From 1db1a702516cf9ae84860c868e165f0d19aa5cb4 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 9 Jan 2021 15:07:57 +0100 Subject: [PATCH] Improve ConcurrentLispSouthboundStats Taking a class-level lock just to increment a value hurts a lot, remove synchronized keyword and simplify the method. Change-Id: I7693ac9a2b4cba308348c0b83583596246b0ff40 Signed-off-by: Robert Varga --- .../southbound/ConcurrentLispSouthboundStats.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/ConcurrentLispSouthboundStats.java b/mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/ConcurrentLispSouthboundStats.java index fc8ee16e2..3e0fd08a3 100644 --- a/mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/ConcurrentLispSouthboundStats.java +++ b/mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/ConcurrentLispSouthboundStats.java @@ -84,12 +84,8 @@ public class ConcurrentLispSouthboundStats { this.cacheMisses = incrementWithWrap(cacheMisses); } - private static synchronized long incrementWithWrap(long value) { - if (value == Long.MAX_VALUE) { - return 0; - } else { - return value + 1; - } + private static long incrementWithWrap(long value) { + return value == Long.MAX_VALUE ? 0 : value + 1; } // TODO move this method to the appropriate helper class if we start using MessageType in other places -- 2.36.6