aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-24 17:51:01 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-24 17:51:01 +0500
commit0e3c39e9d6f165c65e6156e05edc048bad9f57bc (patch)
tree8af3954fae054a33ae0d87f1425afff4d5b73ec8 /src
parent6e08953f5a482b6cecc439bd79b94c03638f77cf (diff)
downloadtraccar-server-0e3c39e9d6f165c65e6156e05edc048bad9f57bc.tar.gz
traccar-server-0e3c39e9d6f165c65e6156e05edc048bad9f57bc.tar.bz2
traccar-server-0e3c39e9d6f165c65e6156e05edc048bad9f57bc.zip
Fix initial cache fill
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/database/DriversManager.java5
-rw-r--r--src/org/traccar/database/SimpleObjectManager.java8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java
index e3ae07a65..f843568b4 100644
--- a/src/org/traccar/database/DriversManager.java
+++ b/src/org/traccar/database/DriversManager.java
@@ -16,7 +16,6 @@
*/
package org.traccar.database;
-import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -32,8 +31,8 @@ public class DriversManager extends ExtendedObjectManager {
}
@Override
- public void addItem(BaseModel item) throws SQLException {
- super.addItem(item);
+ protected void addNewItem(BaseModel item) {
+ super.addNewItem(item);
driversByUniqueId.put(((Driver) item).getUniqueId(), (Driver) item);
}
diff --git a/src/org/traccar/database/SimpleObjectManager.java b/src/org/traccar/database/SimpleObjectManager.java
index 031f91fc5..0f6a9e6a4 100644
--- a/src/org/traccar/database/SimpleObjectManager.java
+++ b/src/org/traccar/database/SimpleObjectManager.java
@@ -99,7 +99,7 @@ public abstract class SimpleObjectManager {
if (items.containsKey(item.getId())) {
updateCachedItem(item);
} else {
- items.put(item.getId(), item);
+ addNewItem(item);
}
}
for (Long cachedItemId : items.keySet()) {
@@ -127,9 +127,13 @@ public abstract class SimpleObjectManager {
}
}
+ protected void addNewItem(BaseModel item) {
+ items.put(item.getId(), item);
+ }
+
public void addItem(BaseModel item) throws SQLException {
dataManager.addObject(item);
- items.put(item.getId(), item);
+ addNewItem(item);
}
protected void updateCachedItem(BaseModel item) {