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.Lock
public void lockInterruptibly()
lockInterruptibly
in interface java.util.concurrent.locks.Lock
public boolean tryLock()
tryLock
in interface java.util.concurrent.locks.Lock
public boolean tryLock(long time, java.util.concurrent.TimeUnit unit)
tryLock
in interface java.util.concurrent.locks.Lock
public void unlock()
unlock
in interface java.util.concurrent.locks.Lock
public java.util.concurrent.locks.Condition newCondition()
newCondition
in interface java.util.concurrent.locks.Lock
java.lang.UnsupportedOperationException
- always.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.