public class JavaLockManager extends BasicLockManager
Note that this managed is not suitable for clusters, as locks are only held locally.
| Modifier and Type | Field and Description |
|---|---|
static String |
NAME
Contains the name of this lock manager
|
| Constructor and Description |
|---|
JavaLockManager() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acquireLock(String lockName)
Actually obtains a lock and returns immediatelly.
|
protected int |
getInitialWait()
If the lock is already aquired, this returns the initial amount of milliseconds to wait.
|
List<LockInfo> |
getLocks()
Returns the list of known locks.
|
protected int |
getMaxWait()
Returns the maximal interval in millis which is spent until a new attempt is made to acquire a lock.
|
String |
getName() |
protected int |
getWaitIncrement()
If the lock is still acquired, this returns the amount of milliseconds to increase the wait interval.
|
boolean |
isLocked(String lock)
Determines if the lock is currently being locked.
|
void |
unlock(String lock,
boolean force)
Unlocks the given lock.
|
tryLockpublic static final String NAME
protected int getMaxWait()
BasicLockManagergetMaxWait in class BasicLockManagerprotected int getWaitIncrement()
BasicLockManagergetWaitIncrement in class BasicLockManagerprotected int getInitialWait()
BasicLockManagergetInitialWait in class BasicLockManagerprotected boolean acquireLock(String lockName)
BasicLockManageracquireLock in class BasicLockManagerlockName - the name of the lock to acquire.public boolean isLocked(@Nonnull String lock)
LockManagerlock - the name of the lock to checkpublic void unlock(String lock, boolean force)
LockManagerlock - the name of the lockforce - true if the lock should be removed, even if it is acquired by another nodepublic List<LockInfo> getLocks()
LockManagerCopyright © 2018. All rights reserved.