Skip to content
Snippets Groups Projects
Commit b86645e9 authored by Ananth Suryanarayana's avatar Ananth Suryanarayana
Browse files

Fix floodlight counter creation issue

parent 5d2c766e
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService {
/**
* A map of counterName --> Counter
*/
protected Map<String, CounterEntry> nameToCEIndex =
protected ConcurrentHashMap<String, CounterEntry> nameToCEIndex =
new ConcurrentHashMap<String, CounterEntry>();
protected ICounter heartbeatCounter;
......@@ -389,17 +389,13 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService {
CounterEntry ce;
ICounter c;
if (!nameToCEIndex.containsKey(key)) {
c = SimpleCounter.createCounter(new Date(), type);
ce = new CounterEntry();
ce.counter = c;
ce.title = key;
nameToCEIndex.put(key, ce);
} else {
throw new IllegalArgumentException("Title for counters must be unique, and there is already a counter with title " + key);
}
return c;
c = SimpleCounter.createCounter(new Date(), type);
ce = new CounterEntry();
ce.counter = c;
ce.title = key;
nameToCEIndex.putIfAbsent(key, ce);
return nameToCEIndex.get(key).counter;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment