aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-30 16:45:55 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-30 16:45:55 -0700
commit2e83b23d258e74df6dfc1c860c2abf9b1b816181 (patch)
tree8363b2708dc3462847baef01a75d068b4e80567b /src/main/java/org/traccar
parent00b91d01d89a32710baa9e580bdf581dae7aa711 (diff)
downloadtrackermap-server-2e83b23d258e74df6dfc1c860c2abf9b1b816181.tar.gz
trackermap-server-2e83b23d258e74df6dfc1c860c2abf9b1b816181.tar.bz2
trackermap-server-2e83b23d258e74df6dfc1c860c2abf9b1b816181.zip
Remove unused code
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java45
1 files changed, 2 insertions, 43 deletions
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index 3b500aba9..0e5056e57 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2022 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 DeviceManager extends BaseObjectManager<Device> implements Identity
private final long dataRefreshDelay;
private Map<String, Device> devicesByUniqueId;
- private Map<String, Device> devicesByPhone;
private final AtomicLong devicesLastUpdate = new AtomicLong();
private final Map<Long, Position> positions = new ConcurrentHashMap<>();
@@ -58,9 +57,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
this.config = Context.getConfig();
try {
writeLock();
- if (devicesByPhone == null) {
- devicesByPhone = new ConcurrentHashMap<>();
- }
if (devicesByUniqueId == null) {
devicesByUniqueId = new ConcurrentHashMap<>();
}
@@ -216,39 +212,10 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
}
}
- private void addByPhone(Device device) {
- try {
- writeLock();
- if (devicesByPhone == null) {
- devicesByPhone = new ConcurrentHashMap<>();
- }
- devicesByPhone.put(device.getPhone(), device);
- } finally {
- writeUnlock();
- }
- }
-
- private void removeByPhone(String phone) {
- if (phone == null || phone.isEmpty()) {
- return;
- }
- try {
- writeLock();
- if (devicesByPhone != null) {
- devicesByPhone.remove(phone);
- }
- } finally {
- writeUnlock();
- }
- }
-
@Override
protected void addNewItem(Device device) {
super.addNewItem(device);
addByUniqueId(device);
- if (device.getPhone() != null && !device.getPhone().isEmpty()) {
- addByPhone(device);
- }
if (Context.getGeofenceManager() != null) {
Position lastPosition = getLastPosition(device.getId());
if (lastPosition != null) {
@@ -264,6 +231,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
cachedDevice.setGroupId(device.getGroupId());
cachedDevice.setCategory(device.getCategory());
cachedDevice.setContact(device.getContact());
+ cachedDevice.setPhone(device.getPhone());
cachedDevice.setModel(device.getModel());
cachedDevice.setDisabled(device.getDisabled());
cachedDevice.setAttributes(device.getAttributes());
@@ -272,13 +240,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
cachedDevice.setUniqueId(device.getUniqueId());
addByUniqueId(cachedDevice);
}
- if (device.getPhone() != null && !device.getPhone().isEmpty()
- && !device.getPhone().equals(cachedDevice.getPhone())) {
- String phone = cachedDevice.getPhone();
- removeByPhone(phone);
- cachedDevice.setPhone(device.getPhone());
- addByPhone(cachedDevice);
- }
}
@Override
@@ -286,10 +247,8 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
Device cachedDevice = getById(deviceId);
if (cachedDevice != null) {
String deviceUniqueId = cachedDevice.getUniqueId();
- String phone = cachedDevice.getPhone();
super.removeCachedItem(deviceId);
removeByUniqueId(deviceUniqueId);
- removeByPhone(phone);
}
positions.remove(deviceId);
}