Package alluxio.concurrent
Class ClientRWLock
- java.lang.Object
-
- alluxio.concurrent.ClientRWLock
-
- All Implemented Interfaces:
java.util.concurrent.locks.ReadWriteLock
@ThreadSafe public final class ClientRWLock extends java.lang.Object implements java.util.concurrent.locks.ReadWriteLock
Read/write lock associated with clients rather than threads. Either its read lock or write lock can be released by a thread different from the one acquiring them (but supposed to be requested by the same client).
-
-
Constructor Summary
Constructors Constructor Description ClientRWLock(int maxReaders)
Constructs a newClientRWLock
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReference()
Increments the reference count.int
dropReference()
Decrements the reference count.int
getReferenceCount()
java.util.concurrent.locks.Lock
readLock()
java.util.concurrent.locks.Lock
writeLock()
-
-
-
Constructor Detail
-
ClientRWLock
public ClientRWLock(int maxReaders)
Constructs a newClientRWLock
.- Parameters:
maxReaders
- total number of permits, decides the max number of concurrent readers
-
-
Method Detail
-
readLock
public java.util.concurrent.locks.Lock readLock()
- Specified by:
readLock
in interfacejava.util.concurrent.locks.ReadWriteLock
-
writeLock
public java.util.concurrent.locks.Lock writeLock()
- Specified by:
writeLock
in interfacejava.util.concurrent.locks.ReadWriteLock
-
getReferenceCount
public int getReferenceCount()
- Returns:
- the reference count
-
addReference
public void addReference()
Increments the reference count.
-
dropReference
public int dropReference()
Decrements the reference count.- Returns:
- the new reference count
-
-