public final class ResourceLock
extends java.util.concurrent.locks.ReentrantLock
implements java.lang.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, unlock
public ResourceLock obtain()
public void close()
close
in interface java.lang.AutoCloseable
Copyright © 2024 PostgreSQL Global Development Group. All rights reserved.