@NotThreadSafe public class LockManagerDefault extends Thread implements LockManager
This class is responsible of managing the lock at high level. It provides 3 main methods which are for acquiring, ensuring(doesn't acquires the lock, just refresh the expiration time if required) and releasing the lock.
Note that this class is not threadSafe and it's not intended to be used by multiple executors. Each of them should acquire a new lock(different key).
life cycle: - acquire - ensure x N - release
| Modifier and Type | Class and Description |
|---|---|
static class |
LockManagerDefault.DefaultLockManagerBuilder |
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier and Type | Method and Description |
|---|---|
void |
acquireLockDefault() |
static LockManagerDefault.DefaultLockManagerBuilder |
builder() |
void |
close() |
void |
ensureLockDefault() |
String |
getDefaultKey() |
long |
getLockTryFrequency() |
String |
getOwner() |
boolean |
isLockHeld() |
boolean |
isReleaseStarted() |
void |
releaseLockDefault() |
void |
run() |
void |
start() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldpublic static LockManagerDefault.DefaultLockManagerBuilder builder()
public String getDefaultKey()
getDefaultKey in interface LockManagerpublic void acquireLockDefault()
throws LockCheckException
acquireLockDefault in interface LockManagerLockCheckExceptionpublic void ensureLockDefault()
throws LockCheckException
ensureLockDefault in interface LockManagerLockCheckExceptionpublic void releaseLockDefault()
releaseLockDefault in interface LockManagerpublic void close()
close in interface LockManagerclose in interface Closeableclose in interface AutoCloseablepublic boolean isReleaseStarted()
isReleaseStarted in interface LockManagerpublic long getLockTryFrequency()
getLockTryFrequency in interface LockManagerpublic String getOwner()
getOwner in interface LockManagerpublic boolean isLockHeld()
isLockHeld in interface LockManagerCopyright © 2023. All rights reserved.