Class NamedSimpleReentrantLock.Acquired
- java.lang.Object
-
- org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.AcquireResult
-
- org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired
-
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- NamedSimpleReentrantLock<T>
public static final class NamedSimpleReentrantLock.Acquired extends NamedSimpleReentrantLock.AcquireResult
Result of a successful lock operation, representing a single lease on the lock.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Revert the lock operation.boolean
wasAcquired()
Indication whether the lock operation succeeded, in which case this method returns true.
-
-
-
Method Detail
-
wasAcquired
public boolean wasAcquired()
Description copied from class:NamedSimpleReentrantLock.AcquireResult
Indication whether the lock operation succeeded, in which case this method returns true. This does not mean that the lock is still being held.- Specified by:
wasAcquired
in classNamedSimpleReentrantLock.AcquireResult
- Returns:
- True if the lock was successfully acquired by the operation which produced this object.
-
close
public void close()
Description copied from class:NamedSimpleReentrantLock.AcquireResult
Revert the lock operation. IfNamedSimpleReentrantLock.AcquireResult.wasAcquired()
returns true, this method releases the underlying lock in an idempotent way. IfNamedSimpleReentrantLock.AcquireResult.wasAcquired()
returns false, this method does nothing.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classNamedSimpleReentrantLock.AcquireResult
-
-