Package io.atomix.client.lock
Interface DistributedLock
- All Superinterfaces:
DistributedPrimitive,Lock,SyncPrimitive<DistributedLock,AsyncDistributedLock>
-
Field Summary
Fields inherited from interface io.atomix.client.SyncPrimitive
DEFAULT_OPERATION_TIMEOUT -
Method Summary
Modifier and TypeMethodDescriptionasync()Returns the underlying asynchronous primitive.static DistributedLockBuilderbuilder(AtomixChannel channel) Returns a new DistributedLock builder.booleanisLocked()Query whether this lock is locked or not.default booleanbooleanAcquires the lock if it is free within the given waiting time and the current thread has not been interrupted.Methods inherited from interface io.atomix.client.DistributedPrimitive
nameMethods inherited from interface java.util.concurrent.locks.Lock
lock, lockInterruptibly, newCondition, tryLock, unlockMethods inherited from interface io.atomix.client.SyncPrimitive
close
-
Method Details
-
builder
Returns a new DistributedLock builder.- Parameters:
channel- the AtomixChannel- Returns:
- the DistributedLock builder
-
tryLock
- Specified by:
tryLockin interfaceLock- Throws:
InterruptedException
-
tryLock
Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted.- Parameters:
timeout- the timeout to wait to acquire the lock- Throws:
InterruptedException- if the current thread is interrupted while acquiring the lock (and interruption of lock acquisition is supported)
-
isLocked
boolean isLocked()Query whether this lock is locked or not.- Returns:
trueif this lock is locked,falseotherwise
-
async
AsyncDistributedLock async()Description copied from interface:SyncPrimitiveReturns the underlying asynchronous primitive.- Specified by:
asyncin interfaceSyncPrimitive<DistributedLock,AsyncDistributedLock> - Returns:
- the underlying asynchronous primitive
-