diff options
author | Eric Fellheimer <felly@google.com> | 2015-08-17 18:29:04 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2015-08-18 10:40:02 +0000 |
commit | 7d315e7648f9d1e8f6366eb90df140dd04c20817 (patch) | |
tree | 89bccb2bc5dca8abdf7435835b7b275e60bb9c1c /src/main | |
parent | 24f2d99880317c928b36bc972eefe43e3134e27a (diff) |
Increase number of stripes in our keyed locker.
--
MOS_MIGRATED_REVID=100843669
Diffstat (limited to 'src/main')
-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() { } |