aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/session/ConnectionManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 14:36:31 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 14:36:31 -0700
commite665a2c7f4dd925bed116961da48bb018d6f57f7 (patch)
treee22e63d11900006234503cbdf0a2016b94a7278f /src/main/java/org/traccar/session/ConnectionManager.java
parent367c6266918a9f21ec6a9eabd091b00016c1d1bf (diff)
downloadtrackermap-server-e665a2c7f4dd925bed116961da48bb018d6f57f7.tar.gz
trackermap-server-e665a2c7f4dd925bed116961da48bb018d6f57f7.tar.bz2
trackermap-server-e665a2c7f4dd925bed116961da48bb018d6f57f7.zip
Remove static injector usages
Diffstat (limited to 'src/main/java/org/traccar/session/ConnectionManager.java')
-rw-r--r--src/main/java/org/traccar/session/ConnectionManager.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java
index cead771c9..05c4893fd 100644
--- a/src/main/java/org/traccar/session/ConnectionManager.java
+++ b/src/main/java/org/traccar/session/ConnectionManager.java
@@ -15,12 +15,12 @@
*/
package org.traccar.session;
+import com.google.inject.Injector;
import io.netty.channel.Channel;
import io.netty.util.Timeout;
import io.netty.util.Timer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.traccar.Main;
import org.traccar.Protocol;
import org.traccar.config.Config;
import org.traccar.config.Keys;
@@ -64,6 +64,7 @@ public class ConnectionManager {
private final Map<Long, DeviceState> deviceStates = new ConcurrentHashMap<>();
+ private final Injector injector;
private final Config config;
private final CacheManager cacheManager;
private final Storage storage;
@@ -75,8 +76,9 @@ public class ConnectionManager {
@Inject
public ConnectionManager(
- Config config, CacheManager cacheManager, Storage storage,
+ Injector injector, Config config, CacheManager cacheManager, Storage storage,
NotificationManager notificationManager, Timer timer) {
+ this.injector = injector;
this.config = config;
this.cacheManager = cacheManager;
this.storage = storage;
@@ -279,15 +281,13 @@ public class ConnectionManager {
DeviceState deviceState = getDeviceState(deviceId);
Map<Event, Position> result = new HashMap<>();
- Map<Event, Position> event = Main.getInjector()
- .getInstance(MotionEventHandler.class).updateMotionState(deviceState);
+ Map<Event, Position> event = injector.getInstance(MotionEventHandler.class).updateMotionState(deviceState);
if (event != null) {
result.putAll(event);
}
double speedLimit = AttributeUtil.lookup(cacheManager, Keys.EVENT_OVERSPEED_LIMIT, deviceId);
- event = Main.getInjector().getInstance(OverspeedEventHandler.class)
- .updateOverspeedState(deviceState, speedLimit);
+ event = injector.getInstance(OverspeedEventHandler.class).updateOverspeedState(deviceState, speedLimit);
if (event != null) {
result.putAll(event);
}