aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/DatabaseHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-31 07:14:34 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-31 07:14:34 -0700
commit05283e44dea22f7b928401f888289840581b28af (patch)
tree9b42a508ad2f1c8af5015f6a0dfbdd772c917afb /src/main/java/org/traccar/handler/DatabaseHandler.java
parent2d366f0ab3d88c635bec0f1f498396cd47557f1d (diff)
downloadtrackermap-server-05283e44dea22f7b928401f888289840581b28af.tar.gz
trackermap-server-05283e44dea22f7b928401f888289840581b28af.tar.bz2
trackermap-server-05283e44dea22f7b928401f888289840581b28af.zip
Simplify main event handler
Diffstat (limited to 'src/main/java/org/traccar/handler/DatabaseHandler.java')
-rw-r--r--src/main/java/org/traccar/handler/DatabaseHandler.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/handler/DatabaseHandler.java b/src/main/java/org/traccar/handler/DatabaseHandler.java
index b1f218a1e..0c8d2717d 100644
--- a/src/main/java/org/traccar/handler/DatabaseHandler.java
+++ b/src/main/java/org/traccar/handler/DatabaseHandler.java
@@ -18,6 +18,7 @@ package org.traccar.handler;
import jakarta.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.traccar.database.StatisticsManager;
import org.traccar.model.Position;
import org.traccar.storage.Storage;
import org.traccar.storage.query.Columns;
@@ -28,10 +29,12 @@ public class DatabaseHandler extends BasePositionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseHandler.class);
private final Storage storage;
+ private final StatisticsManager statisticsManager;
@Inject
- public DatabaseHandler(Storage storage) {
+ public DatabaseHandler(Storage storage, StatisticsManager statisticsManager) {
this.storage = storage;
+ this.statisticsManager = statisticsManager;
}
@Override
@@ -39,6 +42,7 @@ public class DatabaseHandler extends BasePositionHandler {
try {
position.setId(storage.addObject(position, new Request(new Columns.Exclude("id"))));
+ statisticsManager.messageStoredCount(position.getDeviceId());
} catch (Exception error) {
LOGGER.warn("Failed to store position", error);
}