public class SegmentedReentrantReadWriteLock extends Object
Constructor and Description |
---|
SegmentedReentrantReadWriteLock(int numOfSegments,
boolean fair)
Creates a segmented reentrant read write lock using the specified arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
acquireReadLock(int segmentId)
Acquires a read lock on the specified segment.
|
void |
acquireThreadReadLock()
Acquires a read lock on the current thread's segment.
|
void |
acquireWriteLock()
Acquires the write lock.
|
int |
getSegmentIdByCurrentThreadId()
Generates a segment ID from the current thread ID.
|
void |
releaseReadLock(int segmentId)
Releases a read lock on the specified segment.
|
void |
releaseThreadReadLock()
Releases a read lock on the current thread's segment.
|
void |
releaseWriteLock()
Releases the write lock.
|
public SegmentedReentrantReadWriteLock(int numOfSegments, boolean fair)
numOfSegments
- Number of segments to allocate.fair
- true if this lock should use a fair ordering policy.public void acquireWriteLock()
public void releaseWriteLock()
public void acquireReadLock(int segmentId)
public void releaseReadLock(int segmentId)
public int getSegmentIdByCurrentThreadId()
public void acquireThreadReadLock()
public void releaseThreadReadLock()
Copyright © GigaSpaces.