aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-22 07:52:35 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-22 06:52:35 +1300
commit79f3abf6a61220a500e936ffedd7c0d270e9cea4 (patch)
treebce60b6e37506111b7791187ae5784291d787377
parentc5fcf1a6f23c01690ca8643bd3a521ca6509ff75 (diff)
downloadtrackermap-server-79f3abf6a61220a500e936ffedd7c0d270e9cea4.tar.gz
trackermap-server-79f3abf6a61220a500e936ffedd7c0d270e9cea4.tar.bz2
trackermap-server-79f3abf6a61220a500e936ffedd7c0d270e9cea4.zip
Use concurrent maps in connection manager (fix #2723)
-rw-r--r--src/org/traccar/database/ConnectionManager.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java
index 374e9651d..eb81c9ad9 100644
--- a/src/org/traccar/database/ConnectionManager.java
+++ b/src/org/traccar/database/ConnectionManager.java
@@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
public class ConnectionManager {
@@ -42,9 +43,9 @@ public class ConnectionManager {
private final long deviceTimeout;
private final boolean enableStatusEvents;
- private final Map<Long, ActiveDevice> activeDevices = new HashMap<>();
- private final Map<Long, Set<UpdateListener>> listeners = new HashMap<>();
- private final Map<Long, Timeout> timeouts = new HashMap<>();
+ private final Map<Long, ActiveDevice> activeDevices = new ConcurrentHashMap<>();
+ private final Map<Long, Set<UpdateListener>> listeners = new ConcurrentHashMap<>();
+ private final Map<Long, Timeout> timeouts = new ConcurrentHashMap<>();
public ConnectionManager() {
deviceTimeout = Context.getConfig().getLong("status.timeout", DEFAULT_TIMEOUT) * 1000;