aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/Main.java')
-rw-r--r--src/org/traccar/Main.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java
index 1b8d93e34..570becc2d 100644
--- a/src/org/traccar/Main.java
+++ b/src/org/traccar/Main.java
@@ -17,9 +17,14 @@ package org.traccar;
import org.traccar.helper.Log;
+import java.sql.SQLException;
+import java.util.Timer;
+import java.util.TimerTask;
import java.util.Locale;
public final class Main {
+ static final long CLEAN_DELAY = 500;
+ static final long CLEAN_PERIOD = 24 * 60 * 60 * 1000;
private Main() {
}
@@ -35,6 +40,18 @@ public final class Main {
Context.getWebServer().start();
}
+ Timer timer = new Timer();
+ timer.scheduleAtFixedRate(new TimerTask() {
+ @Override
+ public void run() {
+ try {
+ Context.getDataManager().clearPositionsHistory();
+ } catch (SQLException error) {
+ Log.warning(error);
+ }
+ }
+ }, CLEAN_DELAY, CLEAN_PERIOD);
+
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {