Permalink
Browse files

use a concurrent map.

  • Loading branch information...
1 parent b7d3da9 commit 0921302fca57a5bc22a5bd4b1bd6548cd9b7073c @gdusbabek gdusbabek committed Feb 13, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/main/java/org/graylog2/messagehandlers/common/MessageCounter.java
View
8 src/main/java/org/graylog2/messagehandlers/common/MessageCounter.java
@@ -22,8 +22,9 @@
import org.bson.types.ObjectId;
-import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.graylog2.Tools;
/**
@@ -38,6 +39,7 @@
private static MessageCounter instance;
private int total;
+ // todo: may want to consider using a concurrent map in high-scale-lib.
private Map<String, Integer> streams;
private Map<String, Integer> hosts;
@@ -87,11 +89,11 @@ public void resetAllCounts() {
}
public void resetHostCounts() {
- this.hosts = new HashMap<String, Integer>();
+ this.hosts = new ConcurrentHashMap<String, Integer>();
}
public void resetStreamCounts() {
- this.streams = new HashMap<String, Integer>();
+ this.streams = new ConcurrentHashMap<String, Integer>();
}
public void resetTotal() {

0 comments on commit 0921302

Please sign in to comment.