Class InversibleLock
java.lang.Object
org.opendaylight.controller.cluster.access.client.InversibleLock
A lock implementation which allows users to perform optimistic reads and validate them in a fashion similar
to
StampedLock. In case a read is contented with a write, the read side will throw
an InversibleLockException, which the caller can catch and use to wait for the write to resolve.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturn a stamp for read validation.voidunlockWrite(long stamp) booleanvalidate(long stamp) long
-
Constructor Details
-
InversibleLock
public InversibleLock()
-
-
Method Details
-
optimisticRead
public long optimisticRead()Return a stamp for read validation.- Returns:
- A stamp, which can be used with
validate(long). - Throws:
InversibleLockException- if this lock is currently write-locked
-
validate
public boolean validate(long stamp) -
writeLock
public long writeLock() -
unlockWrite
public void unlockWrite(long stamp)
-