diff options
Diffstat (limited to 'src/org/traccar/Main.java')
-rw-r--r-- | src/org/traccar/Main.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 1b8d93e34..eb3114210 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -16,7 +16,8 @@ package org.traccar; import org.traccar.helper.Log; - +import java.util.Timer; +import java.util.TimerTask; import java.util.Locale; public final class Main { @@ -35,6 +36,20 @@ public final class Main { Context.getWebServer().start(); } + //added by Erez + Timer timer = new Timer(); + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + // Clean positions history every day + try { + Context.getDataManager().clearPositionsHistory(); + } catch (Exception error) { + Log.warning(error); + } + } + }, 10*1000, 24*60*60*1000); + Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { |