diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-02 17:11:17 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-02 17:11:17 -0700 |
commit | 6e1d43d86414281ca562c45488b82808936fc980 (patch) | |
tree | b26800225a5439c86d9fc441f96bb690dde4f77a /src/main/java/org/traccar/session/cache | |
parent | 5032f99c6462ca97f3629abe1faf2f50cc4977fe (diff) | |
download | trackermap-server-6e1d43d86414281ca562c45488b82808936fc980.tar.gz trackermap-server-6e1d43d86414281ca562c45488b82808936fc980.tar.bz2 trackermap-server-6e1d43d86414281ca562c45488b82808936fc980.zip |
Integrate cache manager
Diffstat (limited to 'src/main/java/org/traccar/session/cache')
-rw-r--r-- | src/main/java/org/traccar/session/cache/CacheManager.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java index ae514ce8b..d019b072b 100644 --- a/src/main/java/org/traccar/session/cache/CacheManager.java +++ b/src/main/java/org/traccar/session/cache/CacheManager.java @@ -99,7 +99,9 @@ public class CacheManager { public void addDevice(long deviceId) throws StorageException { try { lock.writeLock().lock(); - unsafeAddDevice(deviceId); + if (!deviceLinks.containsKey(deviceId)) { + unsafeAddDevice(deviceId); + } } finally { lock.writeLock().unlock(); } @@ -108,7 +110,9 @@ public class CacheManager { public void removeDevice(long deviceId) { try { lock.writeLock().lock(); - unsafeRemoveDevice(deviceId); + if (deviceLinks.containsKey(deviceId)) { + unsafeRemoveDevice(deviceId); + } } finally { lock.writeLock().unlock(); } |