Package org.onosproject.store.service
Interface DistributedLock
- 
- All Superinterfaces:
- DistributedPrimitive
 - All Known Implementing Classes:
- DefaultDistributedLock
 
 public interface DistributedLock extends DistributedPrimitive Asynchronous lock primitive.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.onosproject.store.service.DistributedPrimitiveDistributedPrimitive.Status, DistributedPrimitive.Type
 
- 
 - 
Field Summary- 
Fields inherited from interface org.onosproject.store.service.DistributedPrimitiveDEFAULT_OPERATION_TIMEOUT_MILLIS
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Versionlock()Acquires the lock, blocking until it's available.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.java.util.Optional<Version>tryLock()Attempts to acquire the lock.java.util.Optional<Version>tryLock(java.time.Duration timeout)Attempts to acquire the lock for a specified amount of time.voidunlock()Unlocks the lock.- 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitiveaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
 
- 
 
- 
- 
- 
Method Detail- 
primitiveTypedefault DistributedPrimitive.Type primitiveType() Description copied from interface:DistributedPrimitiveReturns the type of primitive.- Specified by:
- primitiveTypein interface- DistributedPrimitive
- Returns:
- primitive type
 
 - 
lockVersion lock() Acquires the lock, blocking until it's available.- Returns:
- the acquired lock version
 
 - 
tryLockjava.util.Optional<Version> tryLock() Attempts to acquire the lock.- Returns:
- indicates whether the lock was acquired
 
 - 
tryLockjava.util.Optional<Version> tryLock(java.time.Duration timeout) Attempts to acquire the lock for a specified amount of time.- Parameters:
- timeout- the timeout after which to give up attempting to acquire the lock
- Returns:
- indicates whether the lock was acquired
 
 - 
unlockvoid unlock() Unlocks the lock.
 
- 
 
-