Package alluxio.resource
Class RWLockResource
- java.lang.Object
-
- alluxio.resource.LockResource
-
- alluxio.resource.RWLockResource
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
RefCountLockResource
public class RWLockResource extends LockResource
TheRWLockResource
is an extension of theLockResource
which allows for downgrading of locks.
-
-
Field Summary
-
Fields inherited from class alluxio.resource.LockResource
mLock
-
-
Constructor Summary
Constructors Constructor Description RWLockResource(java.util.concurrent.locks.ReentrantReadWriteLock rwLock, LockMode mode, boolean acquireLock, boolean useTryLock)
Creates a new instance of RW lock that will lock with the given mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
downgrade()
Downgrade from a write to a read lock.-
Methods inherited from class alluxio.resource.LockResource
close, hasSameLock
-
-
-
-
Constructor Detail
-
RWLockResource
public RWLockResource(java.util.concurrent.locks.ReentrantReadWriteLock rwLock, LockMode mode, boolean acquireLock, boolean useTryLock)
Creates a new instance of RW lock that will lock with the given mode.- Parameters:
rwLock
- the read-write lock backing the resourcemode
- the initial lock mode if acquiring the lockacquireLock
- whether or not to acquire the lockuseTryLock
- whether or not to useLock.tryLock()
when acquiring the resource
-
-