Move statistics request functions into trackers
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / MultipartMessageManager.java
index 0ce551a17c5f4f0ab94577f863abc4f09d2339ac..e52a718a4e26c389af1c990b874fa8e81468682e 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.controller.md.statistics.manager;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionAware;
@@ -32,12 +32,12 @@ public class MultipartMessageManager {
      *  by Statistics Manager. Statistics Manager won't entertain any multipart
      *  response for which it didn't send the request.
      */
-    private final Map<TxIdEntry,Long> txIdToRequestTypeMap = new HashMap<>();
+    private final Map<TxIdEntry,Long> txIdToRequestTypeMap = new ConcurrentHashMap<>();
     /*
      * Map to keep track of the request tx id for flow table statistics request.
      * Because flow table statistics multi part response do not contains the table id.
      */
-    private final Map<TxIdEntry,Short> txIdTotableIdMap = new HashMap<>();
+    private final Map<TxIdEntry,Short> txIdTotableIdMap = new ConcurrentHashMap<>();
 
     private static final class TxIdEntry {
         private final StatsRequestType requestType;
@@ -126,7 +126,7 @@ public class MultipartMessageManager {
                 StatisticsProvider.STATS_COLLECTION_MILLIS*NUMBER_OF_WAIT_CYCLES);
     }
 
-    public enum StatsRequestType{
+    public enum StatsRequestType {
         ALL_FLOW,
         AGGR_FLOW,
         ALL_PORT,
@@ -138,7 +138,7 @@ public class MultipartMessageManager {
         METER_CONFIG
     }
 
-    public void cleanStaleTransactionIds(){
+    public void cleanStaleTransactionIds() {
         final long now = System.nanoTime();
 
         for (Iterator<TxIdEntry> it = txIdToRequestTypeMap.keySet().iterator();it.hasNext();){