Sonar: Constants should be declared "final static" 27/34927/1
authorLorand Jakab <lojakab@cisco.com>
Thu, 18 Feb 2016 19:15:51 +0000 (21:15 +0200)
committerLorand Jakab <lojakab@cisco.com>
Thu, 18 Feb 2016 19:15:51 +0000 (21:15 +0200)
Change-Id: I625dee28e39d5919f79a512a3cb95ef947870848
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/inmemorydb/src/main/java/org/opendaylight/lispflowmapping/inmemorydb/HashMapDb.java

index 3f58480ca2c2c3ee673411435bfa747a249f8bc8..102162a8f832cbd4be539ba32059e5fc9ecd3d37 100644 (file)
@@ -24,10 +24,12 @@ import org.slf4j.LoggerFactory;
 public class HashMapDb implements ILispDAO, AutoCloseable {
 
     protected static final Logger LOG = LoggerFactory.getLogger(HashMapDb.class);
-    private ConcurrentMap<Object, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<Object, ConcurrentMap<String, Object>>();
+    private static final Object TABLES = (Object) "tables";
+    private static final int DEFAULT_RECORD_TIMEOUT = 240;   // SB registered mapping entries time out after 4 min
+    private ConcurrentMap<Object, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<Object,
+            ConcurrentMap<String, Object>>();
     private TimeUnit timeUnit = TimeUnit.SECONDS;
-    private int recordTimeOut = 240;
-    private final Object TABLES = (Object) "tables";
+    private int recordTimeOut = DEFAULT_RECORD_TIMEOUT;
 
     @Override
     public void put(Object key, MappingEntry<?>... values) {
@@ -92,7 +94,8 @@ public class HashMapDb implements ILispDAO, AutoCloseable {
             }
 
             private boolean isExpired(Date date) {
-                return System.currentTimeMillis() - date.getTime() > TimeUnit.MILLISECONDS.convert(recordTimeOut, timeUnit);
+                return System.currentTimeMillis() - date.getTime()
+                        > TimeUnit.MILLISECONDS.convert(recordTimeOut, timeUnit);
             }
         });
     }