aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler
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/handler
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/handler')
-rw-r--r--src/main/java/org/traccar/handler/ComputedAttributesHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/CopyAttributesHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/DefaultDataHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/DistanceHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/EngineHoursHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/FilterHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/HemisphereHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/MotionHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/RemoteAddressHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/SpeedLimitHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/TimeHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/AlertEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/BehaviorEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/CommandResultEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/DriverEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/FuelEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/GeofenceEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/IgnitionEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/MediaEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/MotionEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/OverspeedEventHandler.java2
22 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
index 82ac4e804..c9f1f63d7 100644
--- a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
@@ -40,7 +40,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class ComputedAttributesHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/CopyAttributesHandler.java b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
index 1fa47cfaa..e5c9bc29a 100644
--- a/src/main/java/org/traccar/handler/CopyAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
@@ -25,7 +25,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class CopyAttributesHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/DefaultDataHandler.java b/src/main/java/org/traccar/handler/DefaultDataHandler.java
index f6a20628b..89255a5fe 100644
--- a/src/main/java/org/traccar/handler/DefaultDataHandler.java
+++ b/src/main/java/org/traccar/handler/DefaultDataHandler.java
@@ -25,7 +25,9 @@ import org.traccar.storage.query.Columns;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class DefaultDataHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/DistanceHandler.java b/src/main/java/org/traccar/handler/DistanceHandler.java
index 87c4a81c9..30dc9ff2b 100644
--- a/src/main/java/org/traccar/handler/DistanceHandler.java
+++ b/src/main/java/org/traccar/handler/DistanceHandler.java
@@ -25,9 +25,11 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.math.BigDecimal;
import java.math.RoundingMode;
+@Singleton
@ChannelHandler.Sharable
public class DistanceHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/EngineHoursHandler.java b/src/main/java/org/traccar/handler/EngineHoursHandler.java
index 54a1a0c25..c10fe9064 100644
--- a/src/main/java/org/traccar/handler/EngineHoursHandler.java
+++ b/src/main/java/org/traccar/handler/EngineHoursHandler.java
@@ -22,7 +22,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class EngineHoursHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/FilterHandler.java b/src/main/java/org/traccar/handler/FilterHandler.java
index 37f5cd566..f09cb16a3 100644
--- a/src/main/java/org/traccar/handler/FilterHandler.java
+++ b/src/main/java/org/traccar/handler/FilterHandler.java
@@ -35,8 +35,10 @@ import org.traccar.storage.query.Order;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Date;
+@Singleton
@ChannelHandler.Sharable
public class FilterHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/HemisphereHandler.java b/src/main/java/org/traccar/handler/HemisphereHandler.java
index f760457a3..ccbde9fe5 100644
--- a/src/main/java/org/traccar/handler/HemisphereHandler.java
+++ b/src/main/java/org/traccar/handler/HemisphereHandler.java
@@ -22,7 +22,9 @@ import org.traccar.config.Keys;
import org.traccar.model.Position;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class HemisphereHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/MotionHandler.java b/src/main/java/org/traccar/handler/MotionHandler.java
index 25ee615c5..10312f9b3 100644
--- a/src/main/java/org/traccar/handler/MotionHandler.java
+++ b/src/main/java/org/traccar/handler/MotionHandler.java
@@ -22,7 +22,9 @@ import org.traccar.model.Position;
import org.traccar.reports.common.TripsConfig;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class MotionHandler extends BaseDataHandler {
diff --git a/src/main/java/org/traccar/handler/RemoteAddressHandler.java b/src/main/java/org/traccar/handler/RemoteAddressHandler.java
index 809f67ca2..e18d34ef2 100644
--- a/src/main/java/org/traccar/handler/RemoteAddressHandler.java
+++ b/src/main/java/org/traccar/handler/RemoteAddressHandler.java
@@ -23,8 +23,10 @@ import org.traccar.config.Keys;
import org.traccar.model.Position;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.net.InetSocketAddress;
+@Singleton
@ChannelHandler.Sharable
public class RemoteAddressHandler extends ChannelInboundHandlerAdapter {
diff --git a/src/main/java/org/traccar/handler/SpeedLimitHandler.java b/src/main/java/org/traccar/handler/SpeedLimitHandler.java
index 0469b9f16..0c6025999 100644
--- a/src/main/java/org/traccar/handler/SpeedLimitHandler.java
+++ b/src/main/java/org/traccar/handler/SpeedLimitHandler.java
@@ -24,7 +24,9 @@ import org.traccar.model.Position;
import org.traccar.speedlimit.SpeedLimitProvider;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class SpeedLimitHandler extends ChannelInboundHandlerAdapter {
diff --git a/src/main/java/org/traccar/handler/TimeHandler.java b/src/main/java/org/traccar/handler/TimeHandler.java
index 439c076c7..c98b0bd4c 100644
--- a/src/main/java/org/traccar/handler/TimeHandler.java
+++ b/src/main/java/org/traccar/handler/TimeHandler.java
@@ -24,10 +24,12 @@ import org.traccar.config.Keys;
import org.traccar.model.Position;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+@Singleton
@ChannelHandler.Sharable
public class TimeHandler extends ChannelInboundHandlerAdapter {
diff --git a/src/main/java/org/traccar/handler/events/AlertEventHandler.java b/src/main/java/org/traccar/handler/events/AlertEventHandler.java
index 75626ca6c..9f77df989 100644
--- a/src/main/java/org/traccar/handler/events/AlertEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/AlertEventHandler.java
@@ -26,7 +26,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class AlertEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java b/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
index 3c2fa6a97..51bbd82d6 100644
--- a/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
@@ -24,9 +24,11 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Collections;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class BehaviorEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java b/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
index 858f84e09..772176e9c 100644
--- a/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
@@ -23,7 +23,9 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class CommandResultEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/DriverEventHandler.java b/src/main/java/org/traccar/handler/events/DriverEventHandler.java
index 1ad66ba64..51fdc0307 100644
--- a/src/main/java/org/traccar/handler/events/DriverEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/DriverEventHandler.java
@@ -23,9 +23,11 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Collections;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class DriverEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/FuelEventHandler.java b/src/main/java/org/traccar/handler/events/FuelEventHandler.java
index d5d4ab9be..462cc4223 100644
--- a/src/main/java/org/traccar/handler/events/FuelEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/FuelEventHandler.java
@@ -25,8 +25,10 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class FuelEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java b/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
index 70bdb84cb..b1be7e8ad 100644
--- a/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
@@ -33,11 +33,13 @@ import org.traccar.storage.query.Condition;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class GeofenceEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java b/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
index 3c5ac3545..b2e9a3325 100644
--- a/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
@@ -27,7 +27,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class IgnitionEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java b/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
index be3e9bf8d..4fcfcd079 100644
--- a/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
@@ -26,7 +26,9 @@ import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
+import javax.inject.Singleton;
+@Singleton
@ChannelHandler.Sharable
public class MaintenanceEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/MediaEventHandler.java b/src/main/java/org/traccar/handler/events/MediaEventHandler.java
index 5b9013fad..a49e08e8d 100644
--- a/src/main/java/org/traccar/handler/events/MediaEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/MediaEventHandler.java
@@ -20,10 +20,12 @@ import org.traccar.model.Event;
import org.traccar.model.Position;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+@Singleton
@ChannelHandler.Sharable
public class MediaEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/MotionEventHandler.java b/src/main/java/org/traccar/handler/events/MotionEventHandler.java
index 0777f353a..3511cf682 100644
--- a/src/main/java/org/traccar/handler/events/MotionEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/MotionEventHandler.java
@@ -34,9 +34,11 @@ import org.traccar.storage.query.Condition;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Collections;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class MotionEventHandler extends BaseEventHandler {
diff --git a/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java b/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
index c03b8eb7b..3928fcc88 100644
--- a/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
@@ -37,9 +37,11 @@ import org.traccar.storage.query.Condition;
import org.traccar.storage.query.Request;
import javax.inject.Inject;
+import javax.inject.Singleton;
import java.util.Collections;
import java.util.Map;
+@Singleton
@ChannelHandler.Sharable
public class OverspeedEventHandler extends BaseEventHandler {