From 3687f2abb615d6c788bf0093ca5bf7ba33c60486 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 2 May 2018 13:27:28 -0700 Subject: Automatic code cleanup. PiperOrigin-RevId: 195141891 --- .../build/lib/concurrent/FastHotKeyAtomicLongMap.java | 13 +++++++------ .../build/lib/profiler/memory/AllocationTracker.java | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/google') 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 { private final ConcurrentMap map; public static FastHotKeyAtomicLongMap create() { - return new FastHotKeyAtomicLongMap<>(new MapMaker()); + return new FastHotKeyAtomicLongMap<>(); } - public static FastHotKeyAtomicLongMap create(int concurrencyLevel) { - return new FastHotKeyAtomicLongMap<>(new MapMaker().concurrencyLevel(concurrencyLevel)); + // TODO(kak): Delete this in favor of create() + public static FastHotKeyAtomicLongMap 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 allocations = - new MapMaker().weakKeys().concurrencyLevel(1).makeMap(); + private final Map allocations = new MapMaker().weakKeys().makeMap(); private final int samplePeriod; private final int sampleVariance; private boolean enabled = true; -- cgit v1.2.3