public class RefCountLockResource extends RWLockResource
mLock
Constructor and Description |
---|
RefCountLockResource(ReentrantReadWriteLock lock,
LockMode mode,
boolean acquireLock,
AtomicInteger refCount,
boolean useTryLock)
Creates a new instance of
LockResource using the given lock and reference counter. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases the lock and decrement the ref count if a ref counter was provided
at construction time.
|
downgrade
hasSameLock
public RefCountLockResource(ReentrantReadWriteLock lock, LockMode mode, boolean acquireLock, AtomicInteger refCount, boolean useTryLock)
LockResource
using the given lock and reference counter. The
reference counter should have been initialized and incremented outside of this class.lock
- the lock to acquiremode
- the mode to acquire the lock inacquireLock
- whether to lock the lockrefCount
- ref count for the lockuseTryLock
- applicable only if acquireLock is true. Determines whether or not to use
Lock.tryLock()
or Lock.lock()
to acquire the lockpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class LockResource
Copyright © 2023. All Rights Reserved.