public final class ResourceLock extends ReentrantLock implements AutoCloseable
try (ResourceLock ignore = lock.obtain()) {
// do something while holding the resource lock
}
| Constructor and Description |
|---|
ResourceLock() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Unlock on exit of try-with-resources block.
|
ResourceLock |
obtain()
Obtain a lock and return the ResourceLock for use in try-with-resources block.
|
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlockpublic ResourceLock obtain()
public void close()
close in interface AutoCloseableCopyright © 1997-2023 PostgreSQL Global Development Group. All Rights Reserved.