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.
|
tryLock
public static final String NAME
protected int getMaxWait()
BasicLockManager
getMaxWait
in class BasicLockManager
protected int getWaitIncrement()
BasicLockManager
getWaitIncrement
in class BasicLockManager
protected int getInitialWait()
BasicLockManager
getInitialWait
in class BasicLockManager
protected boolean acquireLock(String lockName)
BasicLockManager
acquireLock
in class BasicLockManager
lockName
- the name of the lock to acquire.public boolean isLocked(@Nonnull String lock)
LockManager
lock
- the name of the lock to checkpublic void unlock(String lock, boolean force)
LockManager
lock
- the name of the lockforce
- true if the lock should be removed, even if it is acquired by another nodepublic List<LockInfo> getLocks()
LockManager
Copyright © 2018. All rights reserved.