aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/TrackerEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
commit2a3fad9496decd83f06ae5abf067f8d4337ec741 (patch)
tree69837f0bf89cf6ff78915d70380118575cc5c47a /src/org/traccar/TrackerEventHandler.java
parenta8d2a0170b7ac891ffe784320ac2d1389f11bf68 (diff)
downloadtrackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.gz
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.bz2
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.zip
Major code refacroting
Diffstat (limited to 'src/org/traccar/TrackerEventHandler.java')
-rw-r--r--src/org/traccar/TrackerEventHandler.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/org/traccar/TrackerEventHandler.java b/src/org/traccar/TrackerEventHandler.java
index ecce97fa4..bc3ff0e16 100644
--- a/src/org/traccar/TrackerEventHandler.java
+++ b/src/org/traccar/TrackerEventHandler.java
@@ -27,14 +27,6 @@ import org.traccar.model.Position;
@ChannelHandler.Sharable
public class TrackerEventHandler extends IdleStateAwareChannelHandler {
- private final DataManager dataManager;
- private final DataCache dataCache;
-
- TrackerEventHandler(DataManager dataManager, DataCache dataCache) {
- this.dataManager = dataManager;
- this.dataCache = dataCache;
- }
-
private Long processSinglePosition(Position position) {
if (position == null) {
Log.info("processSinglePosition null message");
@@ -50,7 +42,7 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
// Write position to database
Long id = null;
try {
- id = dataManager.addPosition(position);
+ id = Context.getDataManager().addPosition(position);
} catch (Exception error) {
Log.warning(error);
}
@@ -73,8 +65,8 @@ public class TrackerEventHandler extends IdleStateAwareChannelHandler {
}
if (lastPostition != null) {
try {
- dataManager.updateLatestPosition(lastPostition, id);
- dataCache.update(lastPostition);
+ Context.getDataManager().updateLatestPosition(lastPostition, id);
+ Context.getDataCache().update(lastPostition);
} catch (Exception error) {
Log.warning(error);
}