Package org.eclipse.jetty.util.thread
Class AutoLock.WithCondition
java.lang.Object
org.eclipse.jetty.util.thread.AutoLock
org.eclipse.jetty.util.thread.AutoLock.WithCondition
- All Implemented Interfaces:
Serializable,AutoCloseable
- Enclosing class:
- AutoLock
A reentrant lock with a condition that can be used in a try-with-resources statement.
Typical usage:
// Waiting
try (AutoLock lock = _lock.lock())
{
lock.await();
}
// Signaling
try (AutoLock lock = _lock.lock())
{
lock.signalAll();
}
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.thread.AutoLock
AutoLock.WithCondition -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.eclipse.jetty.util.thread.AutoLock
close, isHeldByCurrentThread, newCondition
-
Constructor Details
-
WithCondition
public WithCondition()
-
-
Method Details
-
lock
Description copied from class:AutoLockAcquires the lock.
-
signal
public void signal()- See Also:
-
signalAll
public void signalAll()- See Also:
-
await
- Throws:
InterruptedException- if the current thread is interrupted- See Also:
-
await
- Parameters:
time- the time to waitunit- the time unit- Returns:
- false if the waiting time elapsed
- Throws:
InterruptedException- if the current thread is interrupted- See Also:
-