java.lang.Object
org.mbari.jcommons.util.CloseableLock
- All Implemented Interfaces:
AutoCloseable,Lock
Deprecated.
A wrapper around a ReentrantLock that allows you to use it in a try-with-resources block.
var lock = new CloseableLock();
try (lock.lock()) {
// do something
}
From https://debugagent.com/relearning-java-thread-primitives-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CloseableLock
public CloseableLock()Deprecated. -
CloseableLock
public CloseableLock(boolean fair) Deprecated.
-
-
Method Details
-
getLock
Deprecated. -
close
Deprecated.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
lock
public void lock()Deprecated. -
lockInterruptibly
Deprecated.- Specified by:
lockInterruptiblyin interfaceLock- Throws:
InterruptedException
-
unlock
public void unlock()Deprecated. -
tryLock
public boolean tryLock()Deprecated. -
tryLock
Deprecated.- Specified by:
tryLockin interfaceLock- Throws:
InterruptedException
-
newCondition
Deprecated.- Specified by:
newConditionin interfaceLock
-
AutoCloseableLockinstead