Use ConcurrentNavigableMap 15/104715/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 11:40:36 +0000 (12:40 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 11:41:16 +0000 (12:41 +0100)
Make sure we mark the map as concurrent, as that is the implementation
we use and it seems we rely on it being concurrent.

JIRA: CONTROLLER-2071
Change-Id: I1deb9e42978fbc6373085e8280822f61541f1066
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/atomix/storage/src/main/java/io/atomix/storage/journal/SegmentedJournal.java

index 45490757f8685b5bd529fa7888c2dab716afb52e..a452587b7691247aacd193fa220b575cd9ba560f 100644 (file)
@@ -24,9 +24,9 @@ import java.nio.file.StandardOpenOption;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.NavigableMap;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import java.util.concurrent.ConcurrentNavigableMap;
 import java.util.concurrent.ConcurrentSkipListMap;
 
 import com.google.common.collect.Sets;
@@ -67,7 +67,7 @@ public final class SegmentedJournal<E> implements Journal<E> {
   private final SegmentedJournalWriter<E> writer;
   private volatile long commitIndex;
 
-  private final NavigableMap<Long, JournalSegment<E>> segments = new ConcurrentSkipListMap<>();
+  private final ConcurrentNavigableMap<Long, JournalSegment<E>> segments = new ConcurrentSkipListMap<>();
   private final Collection<SegmentedJournalReader<E>> readers = Sets.newConcurrentHashSet();
   private JournalSegment<E> currentSegment;