aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/DistanceHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 11:08:32 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 11:08:32 -0700
commitddbe4d7de6ae7590e2b927066312597efa129393 (patch)
tree777882e24ce5488b4cfc8a4d6f11119abcbeb7a3 /src/main/java/org/traccar/handler/DistanceHandler.java
parent182656b6dc1fb5d167bb752c16ecf633add001a8 (diff)
downloadtrackermap-server-ddbe4d7de6ae7590e2b927066312597efa129393.tar.gz
trackermap-server-ddbe4d7de6ae7590e2b927066312597efa129393.tar.bz2
trackermap-server-ddbe4d7de6ae7590e2b927066312597efa129393.zip
Remove positions from manager
Diffstat (limited to 'src/main/java/org/traccar/handler/DistanceHandler.java')
-rw-r--r--src/main/java/org/traccar/handler/DistanceHandler.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/handler/DistanceHandler.java b/src/main/java/org/traccar/handler/DistanceHandler.java
index 08c8c068d..fb82b5d8e 100644
--- a/src/main/java/org/traccar/handler/DistanceHandler.java
+++ b/src/main/java/org/traccar/handler/DistanceHandler.java
@@ -20,9 +20,9 @@ import io.netty.channel.ChannelHandler;
import org.traccar.BaseDataHandler;
import org.traccar.config.Config;
import org.traccar.config.Keys;
-import org.traccar.database.IdentityManager;
import org.traccar.helper.DistanceCalculator;
import org.traccar.model.Position;
+import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
import java.math.BigDecimal;
@@ -31,15 +31,15 @@ import java.math.RoundingMode;
@ChannelHandler.Sharable
public class DistanceHandler extends BaseDataHandler {
- private final IdentityManager identityManager;
+ private final CacheManager cacheManager;
private final boolean filter;
private final int coordinatesMinError;
private final int coordinatesMaxError;
@Inject
- public DistanceHandler(Config config, IdentityManager identityManager) {
- this.identityManager = identityManager;
+ public DistanceHandler(Config config, CacheManager cacheManager) {
+ this.cacheManager = cacheManager;
this.filter = config.getBoolean(Keys.COORDINATES_FILTER);
this.coordinatesMinError = config.getInteger(Keys.COORDINATES_MIN_ERROR);
this.coordinatesMaxError = config.getInteger(Keys.COORDINATES_MAX_ERROR);
@@ -54,7 +54,7 @@ public class DistanceHandler extends BaseDataHandler {
}
double totalDistance = 0.0;
- Position last = identityManager != null ? identityManager.getLastPosition(position.getDeviceId()) : null;
+ Position last = cacheManager.getPosition(position.getDeviceId());
if (last != null) {
totalDistance = last.getDouble(Position.KEY_TOTAL_DISTANCE);
if (!position.getAttributes().containsKey(Position.KEY_DISTANCE)) {