Skip to content

Commit

Permalink
Replace ConcurrentSkipListMap for ConcurrentHashMap
Browse files Browse the repository at this point in the history
As the heavy-weight of the concurrency lies within the sequence, for
which we use a ConcurrentLinkedDeque, we can drop more restrictive
ConcurrentSkipListMap for the ConcurrentHashMap. It means the size
values might deviate a little, but that should be fair given the nature
of this in-memory DLQ.

#2021
  • Loading branch information
smcvb committed Aug 30, 2022
1 parent 35320a7 commit 9b9458c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Function;
import java.util.function.Predicate;
Expand All @@ -58,7 +58,7 @@ public class InMemorySequencedDeadLetterQueue<M extends Message<?>> implements S

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final Map<String, Deque<DeadLetter<? extends M>>> deadLetters = new ConcurrentSkipListMap<>();
private final Map<String, Deque<DeadLetter<? extends M>>> deadLetters = new ConcurrentHashMap<>();
private final Set<String> takenSequences = new ConcurrentSkipListSet<>();

private final int maxSequences;
Expand Down

0 comments on commit 9b9458c

Please sign in to comment.