diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-12-29 22:32:00 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-12-29 22:32:00 -0800 |
commit | bdb4aea7ddb7f525d5c476077a88d905d261fdb8 (patch) | |
tree | cfa8352aab61762644ece9f01b7997c05b4a19a4 /src/main/java/org/traccar/database | |
parent | 8fe1e679935688676f7139bb9ed6dc61838d0e2f (diff) | |
download | trackermap-server-bdb4aea7ddb7f525d5c476077a88d905d261fdb8.tar.gz trackermap-server-bdb4aea7ddb7f525d5c476077a88d905d261fdb8.tar.bz2 trackermap-server-bdb4aea7ddb7f525d5c476077a88d905d261fdb8.zip |
Migrate more keys
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/ConnectionManager.java | 12 |
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); } |