Fix syncronization issue with the marker-api

This commit is contained in:
Blue (Lukas Rieger) 2021-06-17 22:56:29 +02:00
parent c31945444d
commit 470a5cbad1
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800

View File

@ -92,6 +92,7 @@ public synchronized void load() throws IOException {
}
private synchronized void load(boolean overwriteChanges) throws IOException {
synchronized (MarkerAPIImpl.class) {
Set<String> externallyRemovedSets = new HashSet<>(markerSets.keySet());
if (markerFile.exists() && markerFile.isFile()) {
@ -132,9 +133,11 @@ private synchronized void load(boolean overwriteChanges) throws IOException {
removedMarkerSets.clear();
}
}
}
@Override
public synchronized void save() throws IOException {
synchronized (MarkerAPIImpl.class) {
load(false);
FileUtils.createFile(markerFile);
@ -150,5 +153,6 @@ public synchronized void save() throws IOException {
removedMarkerSets.clear();
}
}
}