public interface DistributedLock extends Lock
| Modifier and Type | Interface and Description |
|---|---|
static class |
DistributedLock.DistributedLockException
RuntimeException to identify that there was an issue obtaining or otherwise releasing a distributed lock.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
GLOBAL_ENV_CAN_OBTAIN_LOCK_PROPERTY_NAME
Default property name to determine, globally, whether this environment (JVM) can obtain a lock of this type.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canParticipate()
Indicates if the current thread, JVM, or environment can use this lock.
|
boolean |
currentThreadHoldsLock()
Indicates if the current thread holds the lock.
|
lock, lockInterruptibly, newCondition, tryLock, tryLock, unlockstatic final String GLOBAL_ENV_CAN_OBTAIN_LOCK_PROPERTY_NAME
boolean canParticipate()
Lock interface. For example if this method
returns false and someone calls Lock.lockInterruptibly(), then the thread must block interruptably, but should never provide a lock.
Similarly, a call to DistributedLock#tryLock(5000L, TimeUnit.MILLISECONDS), then the thread must block for 5000 milliseconds, and then return false.
This allows someone to determine if a Thread, a JVM, an environment, etc. can ever obtain a lock. Implementations are typically driven by a property, e.g. provided by
Spring's Environment object.boolean currentThreadHoldsLock()
Copyright © 2022. All rights reserved.