public interface DistributedLock extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS
Modifier and Type | Method and Description |
---|---|
Version |
lock()
Acquires the lock, blocking until it's available.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
Optional<Version> |
tryLock()
Attempts to acquire the lock.
|
Optional<Version> |
tryLock(Duration timeout)
Attempts to acquire the lock for a specified amount of time.
|
void |
unlock()
Unlocks the lock.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
Version lock()
Optional<Version> tryLock()
Optional<Version> tryLock(Duration timeout)
timeout
- the timeout after which to give up attempting to acquire the lockvoid unlock()