Skip to content

Commit

Permalink
Use HashMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
szetszwo committed Oct 3, 2024
1 parent fe29cde commit 7a6fef9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
import java.util.function.Supplier;
Expand Down Expand Up @@ -61,7 +61,7 @@ public class LeakDetector {
private static final Logger LOG = LoggerFactory.getLogger(LeakDetector.class);

private static class LeakTrackerSet {
private final Set<LeakTracker> set = Collections.newSetFromMap(new ConcurrentHashMap<>());
private final Set<LeakTracker> set = Collections.newSetFromMap(new HashMap<>());

synchronized boolean remove(LeakTracker tracker) {
return set.remove(tracker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,9 @@ public ReferenceCountedObject<LogEntryProto> retainLog(long index) throws RaftLo
entry.retain();
getRaftLogMetrics().onRaftLogCacheHit();
return entry;
} catch (IllegalStateException ignore) {
// the entry could be removed from the cache and released.
} catch (IllegalStateException ignored) {
// The entry could be removed from the cache and released.
// The exception can be safely ignored since it is the same as cache miss.
}
}

Expand Down

0 comments on commit 7a6fef9

Please sign in to comment.