aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-15 15:49:53 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-15 15:49:53 +0500
commit7933e79e708792569b7dade228f8642392978141 (patch)
treeba72edf55a7168deae8f5d2e54b7d24b607cc036 /src/org/traccar/database
parentf08bb5adf425269a00e760c669bdeeadc8c7e112 (diff)
downloadtrackermap-server-7933e79e708792569b7dade228f8642392978141.tar.gz
trackermap-server-7933e79e708792569b7dade228f8642392978141.tar.bz2
trackermap-server-7933e79e708792569b7dade228f8642392978141.zip
Fix rare Stack Overflow while server idle
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index f5df1b84b..a530399c7 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -150,13 +150,18 @@ public class DataManager implements IdentityManager {
if (force || System.currentTimeMillis() - devicesLastUpdate > dataRefreshDelay) {
devicesById.clear();
devicesByUniqueId.clear();
+ ConnectionManager connectionManager = Context.getConnectionManager();
+ GeofenceManager geofenceManager = Context.getGeofenceManager();
for (Device device : getAllDevices()) {
devicesById.put(device.getId(), device);
devicesByUniqueId.put(device.getUniqueId(), device);
- }
- GeofenceManager geofenceManager = Context.getGeofenceManager();
- if (geofenceManager != null) {
- geofenceManager.refresh();
+ if (connectionManager != null && geofenceManager != null) {
+ Position lastPosition = Context.getConnectionManager().getLastPosition(device.getId());
+ if (lastPosition != null) {
+ device.setGeofenceIds(Context.getGeofenceManager()
+ .getCurrentDeviceGeofences(lastPosition));
+ }
+ }
}
devicesLastUpdate = System.currentTimeMillis();
}