Package org.agrona.concurrent
Class NoOpLock
java.lang.Object
org.agrona.concurrent.NoOpLock
- All Implemented Interfaces:
Lock
A
Lock
implementation that is a no operation, i.e. it effectively does nothing.
Useful for effectively eliding a lock in a single threaded environment.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
INSTANCE
As there is no instance state then this object can be used to save on allocation.
-
-
Constructor Details
-
NoOpLock
public NoOpLock()Create a new instance.
-
-
Method Details
-
lock
public void lock()Proceeds as if the lock has been acquired. -
lockInterruptibly
public void lockInterruptibly()Proceeds as if the lock has been acquired.- Specified by:
lockInterruptibly
in interfaceLock
-
tryLock
public boolean tryLock()Always succeeds. -
tryLock
Always succeeds. -
unlock
public void unlock()The lock has never been taken so no effect. -
newCondition
Not supported.- Specified by:
newCondition
in interfaceLock
- Returns:
- never returns.
- Throws:
UnsupportedOperationException
- if used.
-