aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-05-02 13:27:28 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-02 13:32:18 -0700
commit3687f2abb615d6c788bf0093ca5bf7ba33c60486 (patch)
tree97139431cc757c1a05bbac786f2c2f50857b113f /src/main/java/com/google
parent53af74ad4ba4004eb24117368d2de5e622e7ddef (diff)
Automatic code cleanup.
PiperOrigin-RevId: 195141891
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/concurrent/FastHotKeyAtomicLongMap.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/memory/AllocationTracker.java3
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;