aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/ConnectionManager.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/database/ConnectionManager.java b/src/main/java/org/traccar/database/ConnectionManager.java
index 8278baa7c..5ff27c187 100644
--- a/src/main/java/org/traccar/database/ConnectionManager.java
+++ b/src/main/java/org/traccar/database/ConnectionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,6 @@ public class ConnectionManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionManager.class);
private final long deviceTimeout;
- private final boolean enableStatusEvents;
private final boolean updateDeviceState;
private final Map<Long, ActiveDevice> activeDevices = new ConcurrentHashMap<>();
@@ -55,8 +54,7 @@ public class ConnectionManager {
public ConnectionManager() {
deviceTimeout = Context.getConfig().getLong(Keys.STATUS_TIMEOUT) * 1000;
- enableStatusEvents = Context.getConfig().getBoolean("event.enable");
- updateDeviceState = Context.getConfig().getBoolean("status.updateDeviceState");
+ updateDeviceState = Context.getConfig().getBoolean(Keys.STATUS_UPDATE_DEVICE_STATE);
}
public void addActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) {
@@ -86,7 +84,7 @@ public class ConnectionManager {
String oldStatus = device.getStatus();
device.setStatus(status);
- if (enableStatusEvents && !status.equals(oldStatus)) {
+ if (!status.equals(oldStatus)) {
String eventType;
Map<Event, Position> events = new HashMap<>();
switch (status) {
@@ -194,14 +192,14 @@ public class ConnectionManager {
public synchronized void addListener(long userId, UpdateListener listener) {
if (!listeners.containsKey(userId)) {
- listeners.put(userId, new HashSet<UpdateListener>());
+ listeners.put(userId, new HashSet<>());
}
listeners.get(userId).add(listener);
}
public synchronized void removeListener(long userId, UpdateListener listener) {
if (!listeners.containsKey(userId)) {
- listeners.put(userId, new HashSet<UpdateListener>());
+ listeners.put(userId, new HashSet<>());
}
listeners.get(userId).remove(listener);
}