public final class NoOpLock
extends java.lang.Object
implements java.util.concurrent.locks.Lock
Lock implementation that is a no operation, i.e. it effectively does nothing.
Useful for effectively eliding a lock in a single threaded environment.
| Constructor and Description |
|---|
NoOpLock() |
| Modifier and Type | Method and Description |
|---|---|
void |
lock()
Proceeds as if the lock has been acquired.
|
void |
lockInterruptibly()
Proceeds as if the lock has been acquired.
|
java.util.concurrent.locks.Condition |
newCondition()
Not supported.
|
boolean |
tryLock()
Always succeeds.
|
boolean |
tryLock(long time,
java.util.concurrent.TimeUnit unit)
Always succeeds.
|
void |
unlock()
The lock has never been taken so no effect.
|
public void lock()
lock in interface java.util.concurrent.locks.Lockpublic void lockInterruptibly()
lockInterruptibly in interface java.util.concurrent.locks.Lockpublic boolean tryLock()
tryLock in interface java.util.concurrent.locks.Lockpublic boolean tryLock(long time,
java.util.concurrent.TimeUnit unit)
tryLock in interface java.util.concurrent.locks.Lockpublic void unlock()
unlock in interface java.util.concurrent.locks.Lockpublic java.util.concurrent.locks.Condition newCondition()
newCondition in interface java.util.concurrent.locks.Lockjava.lang.UnsupportedOperationException - always.Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.