aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-02 08:39:06 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-02 08:39:06 -0700
commitae3eddba7e0a6688807f71d2c290618d1c49da05 (patch)
treec0ff0ed14f7ccfcd99973d16e8bcbe52045e8f5b /src/main/java/org/traccar/MainEventHandler.java
parent63a8bb747e92cc98d64bad59464922a9f6be5867 (diff)
downloadtrackermap-server-ae3eddba7e0a6688807f71d2c290618d1c49da05.tar.gz
trackermap-server-ae3eddba7e0a6688807f71d2c290618d1c49da05.tar.bz2
trackermap-server-ae3eddba7e0a6688807f71d2c290618d1c49da05.zip
Use singletons where possible
Diffstat (limited to 'src/main/java/org/traccar/MainEventHandler.java')
-rw-r--r--src/main/java/org/traccar/MainEventHandler.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/MainEventHandler.java b/src/main/java/org/traccar/MainEventHandler.java
index 52eb43faf..17bcad0dd 100644
--- a/src/main/java/org/traccar/MainEventHandler.java
+++ b/src/main/java/org/traccar/MainEventHandler.java
@@ -16,6 +16,7 @@
package org.traccar;
import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.DatagramChannel;
@@ -23,7 +24,6 @@ import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.timeout.IdleStateEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.traccar.broadcast.BroadcastService;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.database.StatisticsManager;
@@ -41,11 +41,14 @@ import org.traccar.storage.query.Condition;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
+@Singleton
+@ChannelHandler.Sharable
public class MainEventHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(MainEventHandler.class);
@@ -57,17 +60,15 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
private final Storage storage;
private final ConnectionManager connectionManager;
private final StatisticsManager statisticsManager;
- private final BroadcastService broadcastService;
@Inject
public MainEventHandler(
Config config, CacheManager cacheManager, Storage storage, ConnectionManager connectionManager,
- StatisticsManager statisticsManager, BroadcastService broadcastService) {
+ StatisticsManager statisticsManager) {
this.cacheManager = cacheManager;
this.storage = storage;
this.connectionManager = connectionManager;
this.statisticsManager = statisticsManager;
- this.broadcastService = broadcastService;
String connectionlessProtocolList = config.getString(Keys.STATUS_IGNORE_OFFLINE);
if (connectionlessProtocolList != null) {
connectionlessProtocols.addAll(Arrays.asList(connectionlessProtocolList.split("[, ]")));