diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-22 23:00:35 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-22 23:00:35 +1200 |
commit | cefba4b9227c8aeb96e290f70689960541755f0d (patch) | |
tree | be4dbe695d79e3b6cad12724ea596c3f112aff97 /src/org/traccar/TrackerEventHandler.java | |
parent | 05b0272bff05efaffcdfe416d1b258607a908d2b (diff) | |
download | trackermap-server-cefba4b9227c8aeb96e290f70689960541755f0d.tar.gz trackermap-server-cefba4b9227c8aeb96e290f70689960541755f0d.tar.bz2 trackermap-server-cefba4b9227c8aeb96e290f70689960541755f0d.zip |
Add latest position cache
Diffstat (limited to 'src/org/traccar/TrackerEventHandler.java')
-rw-r--r-- | src/org/traccar/TrackerEventHandler.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/org/traccar/TrackerEventHandler.java b/src/org/traccar/TrackerEventHandler.java index 39c70ccc7..ecce97fa4 100644 --- a/src/org/traccar/TrackerEventHandler.java +++ b/src/org/traccar/TrackerEventHandler.java @@ -19,23 +19,20 @@ import java.util.List; import org.jboss.netty.channel.*; import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler; import org.jboss.netty.handler.timeout.IdleStateEvent; +import org.traccar.database.DataCache; import org.traccar.helper.Log; import org.traccar.database.DataManager; import org.traccar.model.Position; -/** - * Tracker message handler - */ @ChannelHandler.Sharable public class TrackerEventHandler extends IdleStateAwareChannelHandler { - /** - * Data manager - */ - private DataManager dataManager; + private final DataManager dataManager; + private final DataCache dataCache; - TrackerEventHandler(DataManager newDataManager) { - dataManager = newDataManager; + TrackerEventHandler(DataManager dataManager, DataCache dataCache) { + this.dataManager = dataManager; + this.dataCache = dataCache; } private Long processSinglePosition(Position position) { @@ -77,6 +74,7 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler { if (lastPostition != null) { try { dataManager.updateLatestPosition(lastPostition, id); + dataCache.update(lastPostition); } catch (Exception error) { Log.warning(error); } |