aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/session
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 10:00:52 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 10:00:52 -0700
commitc248ed30047a0525bf792730a0fbd4de0c89ad8e (patch)
tree750adc33654a4f8947e09528cfb85534cfceb8f1 /src/main/java/org/traccar/session
parent68826cdc767bae6b8b39e88667372f0c6161efa9 (diff)
downloadtrackermap-server-c248ed30047a0525bf792730a0fbd4de0c89ad8e.tar.gz
trackermap-server-c248ed30047a0525bf792730a0fbd4de0c89ad8e.tar.bz2
trackermap-server-c248ed30047a0525bf792730a0fbd4de0c89ad8e.zip
Refactor attribute lookup
Diffstat (limited to 'src/main/java/org/traccar/session')
-rw-r--r--src/main/java/org/traccar/session/ConnectionManager.java5
-rw-r--r--src/main/java/org/traccar/session/cache/CacheManager.java4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java
index 6d5fefa75..3fa467b57 100644
--- a/src/main/java/org/traccar/session/ConnectionManager.java
+++ b/src/main/java/org/traccar/session/ConnectionManager.java
@@ -28,6 +28,7 @@ import org.traccar.config.Keys;
import org.traccar.database.NotificationManager;
import org.traccar.handler.events.MotionEventHandler;
import org.traccar.handler.events.OverspeedEventHandler;
+import org.traccar.helper.model.AttributeUtil;
import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -279,9 +280,9 @@ public class ConnectionManager {
result.putAll(event);
}
+ double speedLimit = AttributeUtil.lookup(cacheManager, Keys.EVENT_OVERSPEED_LIMIT, deviceId);
event = Main.getInjector().getInstance(OverspeedEventHandler.class)
- .updateOverspeedState(deviceState, Context.getDeviceManager().
- lookupAttributeDouble(deviceId, OverspeedEventHandler.ATTRIBUTE_SPEED_LIMIT, 0, true, false));
+ .updateOverspeedState(deviceState, speedLimit);
if (event != null) {
result.putAll(event);
}
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java
index 896df83e7..87384f746 100644
--- a/src/main/java/org/traccar/session/cache/CacheManager.java
+++ b/src/main/java/org/traccar/session/cache/CacheManager.java
@@ -74,6 +74,10 @@ public class CacheManager {
invalidateUsers();
}
+ public Config getConfig() {
+ return config;
+ }
+
public <T extends BaseModel> T getObject(Class<T> clazz, long id) {
try {
lock.readLock().lock();