aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/http
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-30 09:51:23 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-30 09:51:23 +1200
commit727e7bfad908abd899d1114c5405f9bf69b47ebc (patch)
tree5c66197f72f4cbb42a1b5cecd5a71fed4b2ed757 /src/org/traccar/http
parent54c54703d66e8991472c1f7476ba4acb424b27d9 (diff)
downloadtrackermap-server-727e7bfad908abd899d1114c5405f9bf69b47ebc.tar.gz
trackermap-server-727e7bfad908abd899d1114c5405f9bf69b47ebc.tar.bz2
trackermap-server-727e7bfad908abd899d1114c5405f9bf69b47ebc.zip
Active devices in connection manager
Diffstat (limited to 'src/org/traccar/http')
-rw-r--r--src/org/traccar/http/AsyncServlet.java10
-rw-r--r--src/org/traccar/http/CommandsServlet.java4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/http/AsyncServlet.java b/src/org/traccar/http/AsyncServlet.java
index 99929731f..e9cb35840 100644
--- a/src/org/traccar/http/AsyncServlet.java
+++ b/src/org/traccar/http/AsyncServlet.java
@@ -36,7 +36,7 @@ import org.jboss.netty.util.Timeout;
import org.jboss.netty.util.TimerTask;
import org.traccar.Context;
import org.traccar.GlobalTimer;
-import org.traccar.database.DataCache;
+import org.traccar.database.ConnectionManager;
import org.traccar.helper.Log;
import org.traccar.model.Position;
import org.traccar.model.User;
@@ -76,19 +76,19 @@ public class AsyncServlet extends HttpServlet {
this.userId = userId;
this.devices.addAll(devices);
- Collection<Position> initialPositions = Context.getDataCache().getInitialState(devices);
+ Collection<Position> initialPositions = Context.getConnectionManager().getInitialState(devices);
for (Position position : initialPositions) {
positions.put(position.getDeviceId(), position);
}
- Context.getDataCache().addListener(devices, dataListener);
+ Context.getConnectionManager().addListener(devices, dataListener);
}
public boolean hasDevice(long deviceId) {
return devices.contains(deviceId);
}
- private final DataCache.DataCacheListener dataListener = new DataCache.DataCacheListener() {
+ private final ConnectionManager.DataCacheListener dataListener = new ConnectionManager.DataCacheListener() {
@Override
public void onUpdate(Position position) {
synchronized (AsyncSession.this) {
@@ -112,7 +112,7 @@ public class AsyncServlet extends HttpServlet {
public void run(Timeout tmt) throws Exception {
synchronized (AsyncSession.this) {
logEvent("sessionTimeout");
- Context.getDataCache().removeListener(devices, dataListener);
+ Context.getConnectionManager().removeListener(devices, dataListener);
synchronized (asyncSessions) {
asyncSessions.remove(userId);
}
diff --git a/src/org/traccar/http/CommandsServlet.java b/src/org/traccar/http/CommandsServlet.java
index f68a7a74e..bf40b79e6 100644
--- a/src/org/traccar/http/CommandsServlet.java
+++ b/src/org/traccar/http/CommandsServlet.java
@@ -31,7 +31,7 @@ public class CommandsServlet extends BaseServlet {
String uniqueId = command.getUniqueId();
- ActiveDevice activeDevice = Context.getDataManager().getActiveDevice(uniqueId);
+ ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(uniqueId);
if(activeDevice == null) {
throw new RuntimeException("The device has not yet registered to the server");
}
@@ -45,7 +45,7 @@ public class CommandsServlet extends BaseServlet {
JsonObject json = Json.createReader(req.getReader()).readObject();
String uniqueId = json.getString("uniqueId");
- ActiveDevice activeDevice = Context.getDataManager().getActiveDevice(uniqueId);
+ ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(uniqueId);
if(activeDevice == null) {
throw new RuntimeException("The device has not yet registered to the server");
}