public class Locker
extends Object
Convenience auto closeable ReentrantLock wrapper.
try (Locker.Lock lock = locker.lock())
{
// something
}
-
Nested Class Summary
Nested Classes
class
The unlocker object that unlocks when it is closed.
class
-
Constructor Summary
Constructors
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Details
-
lock
- Returns:
- the lock to unlock
-
lockIfNotHeld
Deprecated.
- Returns:
- the lock to unlock
-
isLocked
public boolean isLocked()
- Returns:
- whether this lock has been acquired
-
newCondition
- Returns:
- a
Condition associated with this lock
lock()instead