diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-14 17:06:44 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-14 17:06:44 -0700 |
commit | 415ba3ddb0f770b829c997beb3e575ffb6e195ec (patch) | |
tree | 82864fbaf0126b310d3d93abe40160bb371e52c6 /src/main/java/org/traccar/database | |
parent | e43169b2677ea9f07154247ce7ff726d046e59e2 (diff) | |
download | trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.gz trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.bz2 trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.zip |
Inject connection manager
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/DeviceManager.java | 11 |
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); } } |