aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/ConnectionManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
commitd4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch)
tree4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/database/ConnectionManager.java
parent9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff)
downloadtrackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.gz
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.bz2
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.zip
Remove trailing whitespaces from code
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-rw-r--r--src/org/traccar/database/ConnectionManager.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java
index 1aa0dbc57..c34428af5 100644
--- a/src/org/traccar/database/ConnectionManager.java
+++ b/src/org/traccar/database/ConnectionManager.java
@@ -34,7 +34,7 @@ public class ConnectionManager {
private final Map<Long, ActiveDevice> activeDevices = new HashMap<>();
private final Map<Long, Position> positions = new HashMap<>();
private final Map<Long, Set<DataCacheListener>> listeners = new HashMap<>();
-
+
public ConnectionManager(DataManager dataManager) {
if (dataManager != null) {
try {
@@ -50,7 +50,7 @@ public class ConnectionManager {
public void setActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) {
activeDevices.put(deviceId, new ActiveDevice(deviceId, protocol, channel, remoteAddress));
}
-
+
public void removeActiveDevice(Channel channel) {
for (ActiveDevice activeDevice : activeDevices.values()) {
if (activeDevice.getChannel() == channel) {
@@ -73,52 +73,52 @@ public class ConnectionManager {
}
}
}
-
+
public Position getLastPosition(long deviceId) {
return positions.get(deviceId);
}
-
+
public synchronized Collection<Position> getInitialState(Collection<Long> devices) {
-
+
List<Position> result = new LinkedList<>();
-
+
for (long device : devices) {
if (positions.containsKey(device)) {
result.add(positions.get(device));
}
}
-
+
return result;
}
-
+
public static interface DataCacheListener {
public void onUpdate(Position position);
}
-
+
public void addListener(Collection<Long> devices, DataCacheListener listener) {
for (long deviceId : devices) {
addListener(deviceId, listener);
}
}
-
+
public synchronized void addListener(long deviceId, DataCacheListener listener) {
if (!listeners.containsKey(deviceId)) {
listeners.put(deviceId, new HashSet<DataCacheListener>());
}
listeners.get(deviceId).add(listener);
}
-
+
public void removeListener(Collection<Long> devices, DataCacheListener listener) {
for (long deviceId : devices) {
removeListener(deviceId, listener);
}
}
-
+
public synchronized void removeListener(long deviceId, DataCacheListener listener) {
if (!listeners.containsKey(deviceId)) {
listeners.put(deviceId, new HashSet<DataCacheListener>());
}
listeners.get(deviceId).remove(listener);
}
-
+
}