diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java | 13 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java b/src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java index 4136331134..3b64d38216 100644 --- a/src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java +++ b/src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java @@ -14,9 +14,9 @@ package com.google.devtools.build.lib.concurrent; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; @@ -35,15 +35,16 @@ public class FastHotKeyAtomicLongMap<T> { private final ConcurrentMap<T, AtomicLong> map; public static <T> FastHotKeyAtomicLongMap<T> create() { - return new FastHotKeyAtomicLongMap<>(new MapMaker()); + return new FastHotKeyAtomicLongMap<>(); } - public static <T> FastHotKeyAtomicLongMap<T> create(int concurrencyLevel) { - return new FastHotKeyAtomicLongMap<>(new MapMaker().concurrencyLevel(concurrencyLevel)); + // TODO(kak): Delete this in favor of create() + public static <T> FastHotKeyAtomicLongMap<T> create(int concurrencyLevel /* ignored */) { + return new FastHotKeyAtomicLongMap<>(); } - private FastHotKeyAtomicLongMap(MapMaker mapMaker) { - this.map = mapMaker.makeMap(); + private FastHotKeyAtomicLongMap() { + this.map = new ConcurrentHashMap<>(); } public long incrementAndGet(T key) { diff --git a/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java b/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java index ccb353c063..970cac4a5a 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java @@ -66,8 +66,7 @@ public class AllocationTracker implements Sampler { } } - private final Map<Object, AllocationSample> allocations = - new MapMaker().weakKeys().concurrencyLevel(1).makeMap(); + private final Map<Object, AllocationSample> allocations = new MapMaker().weakKeys().makeMap(); private final int samplePeriod; private final int sampleVariance; private boolean enabled = true; |