diff options
author | Abyss777 <abyss@fox5.ru> | 2016-05-27 17:14:47 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-05-27 17:14:47 +0500 |
commit | 6e00239038002aa383cce39be7f53b85f3d03a94 (patch) | |
tree | 6b32aab5891ba74b2fba550b29601a6d5c373273 /src/org/traccar/database/DataManager.java | |
parent | c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe (diff) | |
download | trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.tar.gz trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.tar.bz2 trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.zip |
- Synchronization device cache on updateLatestPosition and updateDeviceStatus
- Better latest position identification in BaseEventHandler
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 4e14f6c97..fcb8899bc 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -358,6 +358,9 @@ public class DataManager implements IdentityManager { QueryBuilder.create(dataSource, getQuery("database.updateDeviceStatus")) .setObject(device) .executeUpdate(); + Device cachedDevice = getDeviceById(device.getId()); + cachedDevice.setStatus(device.getStatus()); + cachedDevice.setMotion(device.getMotion()); } public void removeDevice(long deviceId) throws SQLException { @@ -466,6 +469,8 @@ public class DataManager implements IdentityManager { .setDate("now", new Date()) .setObject(position) .executeUpdate(); + Device device = getDeviceById(position.getDeviceId()); + device.setPositionId(position.getId()); } public Collection<Position> getLatestPositions() throws SQLException { |