aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-14 17:06:44 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-14 17:06:44 -0700
commit415ba3ddb0f770b829c997beb3e575ffb6e195ec (patch)
tree82864fbaf0126b310d3d93abe40160bb371e52c6 /src/main/java/org/traccar/MainEventHandler.java
parente43169b2677ea9f07154247ce7ff726d046e59e2 (diff)
downloadtrackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.gz
trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.bz2
trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.zip
Inject connection manager
Diffstat (limited to 'src/main/java/org/traccar/MainEventHandler.java')
-rw-r--r--src/main/java/org/traccar/MainEventHandler.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/MainEventHandler.java b/src/main/java/org/traccar/MainEventHandler.java
index bb84a09d2..d4a0fae6c 100644
--- a/src/main/java/org/traccar/MainEventHandler.java
+++ b/src/main/java/org/traccar/MainEventHandler.java
@@ -28,6 +28,7 @@ import org.traccar.database.StatisticsManager;
import org.traccar.helper.DateUtil;
import org.traccar.helper.NetworkUtil;
import org.traccar.model.Position;
+import org.traccar.session.ConnectionManager;
import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
@@ -44,8 +45,11 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
private final Set<String> connectionlessProtocols = new HashSet<>();
private final Set<String> logAttributes = new LinkedHashSet<>();
+ private final ConnectionManager connectionManager;
+
@Inject
- public MainEventHandler() {
+ public MainEventHandler(ConnectionManager connectionManager) {
+ this.connectionManager = connectionManager;
String connectionlessProtocolList = Context.getConfig().getString(Keys.STATUS_IGNORE_OFFLINE);
if (connectionlessProtocolList != null) {
connectionlessProtocols.addAll(Arrays.asList(connectionlessProtocolList.split("[, ]")));
@@ -132,7 +136,7 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
if (BasePipelineFactory.getHandler(ctx.pipeline(), HttpRequestDecoder.class) == null
&& !connectionlessProtocols.contains(ctx.pipeline().get(BaseProtocolDecoder.class).getProtocolName())) {
- Context.getConnectionManager().deviceDisconnected(ctx.channel());
+ connectionManager.deviceDisconnected(ctx.channel());
}
}