public class StripedReadWriteLockSync extends Object
BlockingCache
, where it has been in use
in highly concurrent production environments for years.
Based on the lock striping concept from Brian Goetz. See Java Concurrency in Practice 11.4.3Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUMBER_OF_MUTEXES
The default number of locks to use.
|
Constructor and Description |
---|
StripedReadWriteLockSync()
Constructs a striped mutex with the default 2048 stripes.
|
StripedReadWriteLockSync(int numberOfStripes)
Constructs a striped mutex with the default 2048 stripes.
|
Modifier and Type | Method and Description |
---|---|
List<ReadWriteLockSync> |
getAllSyncs()
Returns all internal syncs.
|
ReadWriteLock |
getLockForKey(Object key)
Gets the RWL Stripe to use for a given key.
|
ReadWriteLockSync |
getSyncForKey(Object key)
Gets the Sync Stripe to use for a given key.
|
public static final int DEFAULT_NUMBER_OF_MUTEXES
public StripedReadWriteLockSync()
public StripedReadWriteLockSync(int numberOfStripes)
numberOfStripes
- - must be a factor of twopublic ReadWriteLockSync getSyncForKey(Object key)
key
- the keypublic ReadWriteLock getLockForKey(Object key)
key
- the keypublic List<ReadWriteLockSync> getAllSyncs()
Copyright © 2020 Magnolia International Ltd.. All rights reserved.