diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-06-28 14:46:29 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2021-06-28 14:46:29 +0300 |
commit | c7132087c78e508e07010ddbf64a26d1c1243052 (patch) | |
tree | 0949483a889819f39254b2d2880085f5ede7604a /app/src/main/java/it/niedermann | |
parent | f9ccd7b95bb80f70b386a33e920969931ab75902 (diff) |
Use ConcurrentHashMap for sync related states
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann')
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java index 24a28619..6d2b21c5 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -127,12 +128,12 @@ public class NotesRepository { }; // current state of the synchronization - private final Map<Long, Boolean> syncActive = new HashMap<>(); - private final Map<Long, Boolean> syncScheduled = new HashMap<>(); + private final Map<Long, Boolean> syncActive = new ConcurrentHashMap<>(); + private final Map<Long, Boolean> syncScheduled = new ConcurrentHashMap<>(); // list of callbacks for both parts of synchronization - private final Map<Long, List<ISyncCallback>> callbacksPush = new HashMap<>(); - private final Map<Long, List<ISyncCallback>> callbacksPull = new HashMap<>(); + private final Map<Long, List<ISyncCallback>> callbacksPush = new ConcurrentHashMap<>(); + private final Map<Long, List<ISyncCallback>> callbacksPull = new ConcurrentHashMap<>(); public static synchronized NotesRepository getInstance(@NonNull Context context) { |