diff options
Diffstat (limited to 'src/org/traccar/web/AsyncServlet.java')
-rw-r--r-- | src/org/traccar/web/AsyncServlet.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/web/AsyncServlet.java b/src/org/traccar/web/AsyncServlet.java index 73803ab91..63b08ff3e 100644 --- a/src/org/traccar/web/AsyncServlet.java +++ b/src/org/traccar/web/AsyncServlet.java @@ -50,7 +50,7 @@ public class AsyncServlet extends BaseServlet { public static class AsyncSession { - private static final boolean DEBUG_ASYNC = false; + private static final boolean DEBUG_ASYNC = true; private static final long SESSION_TIMEOUT = 30; private static final long REQUEST_TIMEOUT = 20; @@ -88,7 +88,7 @@ public class AsyncServlet extends BaseServlet { private final ConnectionManager.DataCacheListener dataListener = new ConnectionManager.DataCacheListener() { @Override - public void onUpdate(Position position) { + public void onUpdatePosition(Position position) { synchronized (AsyncSession.this) { logEvent("onUpdate deviceId: " + position.getDeviceId()); if (!destroyed) { @@ -114,7 +114,9 @@ public class AsyncServlet extends BaseServlet { } Context.getConnectionManager().removeListener(devices, dataListener); synchronized (ASYNC_SESSIONS) { - ASYNC_SESSIONS.remove(userId); + if (ASYNC_SESSIONS.get(userId) == AsyncSession.this) { + ASYNC_SESSIONS.remove(userId); + } } } }; |