diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/concurrent')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/concurrent/RefCountedMultisetKeyedLocker.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/concurrent/RefCountedMultisetKeyedLocker.java b/src/main/java/com/google/devtools/build/lib/concurrent/RefCountedMultisetKeyedLocker.java index ee1c2b5dbc..52109ad543 100644 --- a/src/main/java/com/google/devtools/build/lib/concurrent/RefCountedMultisetKeyedLocker.java +++ b/src/main/java/com/google/devtools/build/lib/concurrent/RefCountedMultisetKeyedLocker.java @@ -31,13 +31,14 @@ public class RefCountedMultisetKeyedLocker<K> implements KeyedLocker<K> { // Multiset of keys that have threads waiting on a lock or using a lock. private final ConcurrentHashMultiset<K> waiters = ConcurrentHashMultiset.<K>create(); - private static final int NUM_STRIPES = 256; + private static final int NUM_STRIPES = 2048; // For each key, gives the striped lock to use for atomically managing the waiters on that key // internally. private final Striped<Lock> waitersLocks = Striped.lazyWeakLock(NUM_STRIPES); // Map of key to current lock, for keys that have at least one waiting or live thread. - private final ConcurrentMap<K, ReentrantLock> locks = new ConcurrentHashMap<>(); + private final ConcurrentMap<K, ReentrantLock> locks = + new ConcurrentHashMap<>(1024, .75f, NUM_STRIPES); public RefCountedMultisetKeyedLocker() { } |