Package org.eclipse.jetty.util.thread
Class Locker
- java.lang.Object
-
- org.eclipse.jetty.util.thread.Locker
-
public class Locker extends java.lang.ObjectConvenience auto closeable
ReentrantLockwrapper.try (Locker.Lock lock = locker.lock()) { // something }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLocker.LockThe unlocker object that unlocks when it is closed.classLocker.UnLockDeprecated.
-
Constructor Summary
Constructors Constructor Description Locker()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanisLocked()Locker.Locklock()Acquires the lock.Locker.LocklockIfNotHeld()Deprecated.uselock()insteadjava.util.concurrent.locks.ConditionnewCondition()
-
-
-
Method Detail
-
lock
public Locker.Lock lock()
Acquires the lock.
- Returns:
- the lock to unlock
-
lockIfNotHeld
@Deprecated public Locker.Lock lockIfNotHeld()
Deprecated.uselock()instead- Returns:
- the lock to unlock
-
isLocked
public boolean isLocked()
- Returns:
- whether this lock has been acquired
-
newCondition
public java.util.concurrent.locks.Condition newCondition()
- Returns:
- a
Conditionassociated with this lock
-
-