aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index 20f179f2e..973cf3f68 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -32,6 +32,7 @@ import org.traccar.Context;
import org.traccar.config.Keys;
import org.traccar.model.Command;
import org.traccar.model.Device;
+import org.traccar.session.ConnectionManager;
import org.traccar.session.DeviceState;
import org.traccar.model.DeviceAccumulators;
import org.traccar.model.Group;
@@ -45,6 +46,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
private static final Logger LOGGER = LoggerFactory.getLogger(DeviceManager.class);
private final Config config;
+ private final ConnectionManager connectionManager;
private final long dataRefreshDelay;
private Map<String, Device> devicesByUniqueId;
@@ -54,9 +56,10 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
private final Map<Long, DeviceState> deviceStates = new ConcurrentHashMap<>();
- public DeviceManager(DataManager dataManager) {
+ public DeviceManager(Config config, DataManager dataManager, ConnectionManager connectionManager) {
super(dataManager, Device.class);
- this.config = Context.getConfig();
+ this.config = config;
+ this.connectionManager = connectionManager;
try {
writeLock();
if (devicesByUniqueId == null) {
@@ -287,9 +290,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
positions.put(position.getDeviceId(), position);
- if (Context.getConnectionManager() != null) {
- Context.getConnectionManager().updatePosition(position);
- }
+ connectionManager.updatePosition(position);
}
}