diff --git a/core/src/main/java/bisq/core/account/sign/SignedWitnessService.java b/core/src/main/java/bisq/core/account/sign/SignedWitnessService.java index 17b33d075d7..e2ff6e152d4 100644 --- a/core/src/main/java/bisq/core/account/sign/SignedWitnessService.java +++ b/core/src/main/java/bisq/core/account/sign/SignedWitnessService.java @@ -60,6 +60,7 @@ import java.util.Optional; import java.util.Set; import java.util.Stack; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; @@ -79,7 +80,7 @@ public class SignedWitnessService { // The getSignedWitnessSet is called very often and is a bit expensive. We cache the result in that map but we // remove the cache entry if we get a matching SignedWitness added to the signedWitnessMap. - private final Map> getSignedWitnessSetCache = new HashMap<>(); + private final Map> getSignedWitnessSetCache = new ConcurrentHashMap<>(); private final FilterManager filterManager; diff --git a/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java b/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java index c3f4f196c1a..62ff315d02d 100644 --- a/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/bisq/core/account/witness/AccountAgeWitnessService.java @@ -73,6 +73,7 @@ import java.util.Optional; import java.util.Random; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -143,7 +144,7 @@ public String getDisplayString() { // The accountAgeWitnessMap is very large (70k items) and access is a bit expensive. We usually only access less // than 100 items, those who have offers online. So we use a cache for a fast lookup and only if // not found there we use the accountAgeWitnessMap and put then the new item into our cache. - private final Map accountAgeWitnessCache = new HashMap<>(); + private final Map accountAgeWitnessCache = new ConcurrentHashMap<>(); ///////////////////////////////////////////////////////////////////////////////////////////