Package org.apache.beam.sdk.util
Class NoopLock
- java.lang.Object
-
- org.apache.beam.sdk.util.NoopLock
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.concurrent.locks.Lock
public class NoopLock extends java.lang.Object implements java.util.concurrent.locks.Lock, java.io.Serializable
A lock which can always be acquired. It should not be used when a proper lock is required, but it is useful as a performance optimization when locking is not necessary but the code paths have to be shared between the locking and the non-locking variant.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NoopLock
get()
void
lock()
void
lockInterruptibly()
java.util.concurrent.locks.Condition
newCondition()
boolean
tryLock()
boolean
tryLock(long time, java.util.concurrent.TimeUnit unit)
void
unlock()
-
-
-
Method Detail
-
get
public static NoopLock get()
-
lock
public void lock()
- Specified by:
lock
in interfacejava.util.concurrent.locks.Lock
-
lockInterruptibly
public void lockInterruptibly()
- Specified by:
lockInterruptibly
in interfacejava.util.concurrent.locks.Lock
-
tryLock
public boolean tryLock()
- Specified by:
tryLock
in interfacejava.util.concurrent.locks.Lock
-
tryLock
public boolean tryLock(long time, @Nonnull java.util.concurrent.TimeUnit unit)
- Specified by:
tryLock
in interfacejava.util.concurrent.locks.Lock
-
unlock
public void unlock()
- Specified by:
unlock
in interfacejava.util.concurrent.locks.Lock
-
newCondition
@Nonnull public java.util.concurrent.locks.Condition newCondition()
- Specified by:
newCondition
in interfacejava.util.concurrent.locks.Lock
-
-