public class StripedReadWriteLockSync extends Object implements StripedReadWriteLock
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.3| Modifier 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)
getSyncForKey in interface CacheLockProviderkey - the keypublic ReadWriteLock getLockForKey(Object key)
getLockForKey in interface StripedReadWriteLockkey - the keypublic List<ReadWriteLockSync> getAllSyncs()
getAllSyncs in interface StripedReadWriteLockCopyright © 2003-2014 Terracotta, Inc.. All Rights Reserved.