- java.lang.Object
-
- org.eclipse.jetty.util.thread.AutoLock
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class AutoLock extends java.lang.Object implements java.lang.AutoCloseableReentrant lock that can be used in a try-with-resources statement.try (AutoLock lock = this.lock.lock()) { // Something }
-
-
Constructor Summary
Constructors Constructor Description AutoLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()AutoLocklock()Acquires the lock.java.util.concurrent.locks.ConditionnewCondition()
-
-
-
Method Detail
-
lock
public AutoLock lock()
Acquires the lock.
- Returns:
- this AutoLock for unlocking
-
newCondition
public java.util.concurrent.locks.Condition newCondition()
- Returns:
- a
Conditionassociated with this lock
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-