From 79f3abf6a61220a500e936ffedd7c0d270e9cea4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 22 Dec 2016 07:52:35 +1300 Subject: Use concurrent maps in connection manager (fix #2723) --- src/org/traccar/database/ConnectionManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 activeDevices = new HashMap<>(); - private final Map> listeners = new HashMap<>(); - private final Map timeouts = new HashMap<>(); + private final Map activeDevices = new ConcurrentHashMap<>(); + private final Map> listeners = new ConcurrentHashMap<>(); + private final Map timeouts = new ConcurrentHashMap<>(); public ConnectionManager() { deviceTimeout = Context.getConfig().getLong("status.timeout", DEFAULT_TIMEOUT) * 1000; -- cgit v1.2.3