public class RWLockResource extends LockResource
RWLockResource
is an extension of the LockResource
which allows for
downgrading of locks.mLock
Constructor and Description |
---|
RWLockResource(ReentrantReadWriteLock rwLock,
LockMode mode,
boolean acquireLock,
boolean useTryLock)
Creates a new instance of RW lock that will lock with the given mode.
|
Modifier and Type | Method and Description |
---|---|
boolean |
downgrade()
Downgrade from a write to a read lock.
|
close, hasSameLock
public RWLockResource(ReentrantReadWriteLock rwLock, LockMode mode, boolean acquireLock, boolean useTryLock)
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 use Lock.tryLock()
when
acquiring the resourceCopyright © 2023. All Rights Reserved.