Package org.apache.ignite.internal.util
Class GridStripedReadWriteLock
- java.lang.Object
-
- org.apache.ignite.internal.util.GridStripedReadWriteLock
-
public class GridStripedReadWriteLock extends Object
This is an utility class for 'splitting' locking of someint- orlong-keyed resources. Mapintandlongvalues to some number of locks, and supply convenience methods to obtain and release these locks using key values.
-
-
Constructor Summary
Constructors Constructor Description GridStripedReadWriteLock(int concurrencyLevel)Creates new instance with the given concurrency level (number of locks).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intconcurrencyLevel()Gets concurrency level.ReadWriteLock[]getAllLocks()Gets all locks.ReadWriteLockgetLock(int key)ReturnsLockobject for the given key.ReadWriteLockgetLock(long key)ReturnsLockobject for the given key.ReadWriteLockgetLock(@Nullable Object o)Returns lock for object.StringtoString()
-
-
-
Method Detail
-
concurrencyLevel
public int concurrencyLevel()
Gets concurrency level.- Returns:
- Concurrency level.
-
getAllLocks
public ReadWriteLock[] getAllLocks()
Gets all locks.- Returns:
- All locks.
-
getLock
public ReadWriteLock getLock(int key)
ReturnsLockobject for the given key.- Parameters:
key- Key.- Returns:
- Lock.
-
getLock
public ReadWriteLock getLock(long key)
ReturnsLockobject for the given key.- Parameters:
key- Key.- Returns:
- Lock.
-
getLock
public ReadWriteLock getLock(@Nullable @Nullable Object o)
Returns lock for object.- Parameters:
o- Object.- Returns:
- Lock.
-
-