diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-25 16:20:15 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-25 16:20:15 +1200 |
commit | 4a31e34ca62d4b1941d3bc329afc127ef7263f34 (patch) | |
tree | 09b9ad0420a4819a350bcdcffeeee2342c5d2483 /src/org/traccar/Main.java | |
parent | 866c3073ef48a24d86834a391a4d3d91209a6eed (diff) | |
parent | b4841fa0a6293c0b895cf6bb65c6c2d871c78397 (diff) | |
download | trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.gz trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.bz2 trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.zip |
Merge pull request #2104 from ninioe/master
Added support for Alarm notifications & positions history cleaner & show alarms in report & Mute button & unlock UI files (for windows)
Diffstat (limited to 'src/org/traccar/Main.java')
-rw-r--r-- | src/org/traccar/Main.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 1b8d93e34..e7e8d8ab9 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 = 0; + 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() { |