Skip to content
Snippets Groups Projects
Commit 0dc8a491 authored by abat's avatar abat
Browse files

Merge into master from pull request #307:

BSC-2322 Fix counter creation issue (https://github.com/floodlight/floodlight/pull/307)
parents 5d2c766e b86645e9
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService { ...@@ -66,7 +66,7 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService {
/** /**
* A map of counterName --> Counter * A map of counterName --> Counter
*/ */
protected Map<String, CounterEntry> nameToCEIndex = protected ConcurrentHashMap<String, CounterEntry> nameToCEIndex =
new ConcurrentHashMap<String, CounterEntry>(); new ConcurrentHashMap<String, CounterEntry>();
protected ICounter heartbeatCounter; protected ICounter heartbeatCounter;
...@@ -389,17 +389,13 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService { ...@@ -389,17 +389,13 @@ public class CounterStore implements IFloodlightModule, ICounterStoreService {
CounterEntry ce; CounterEntry ce;
ICounter c; ICounter c;
if (!nameToCEIndex.containsKey(key)) { c = SimpleCounter.createCounter(new Date(), type);
c = SimpleCounter.createCounter(new Date(), type); ce = new CounterEntry();
ce = new CounterEntry(); ce.counter = c;
ce.counter = c; ce.title = key;
ce.title = key; nameToCEIndex.putIfAbsent(key, ce);
nameToCEIndex.put(key, ce);
} else { return nameToCEIndex.get(key).counter;
throw new IllegalArgumentException("Title for counters must be unique, and there is already a counter with title " + key);
}
return c;
} }
/** /**
......
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