public abstract class BasicLockManager extends Object implements LockManager
| Constructor and Description |
|---|
BasicLockManager() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
acquireLock(String lockName)
Actually obtains a lock and returns immediatelly.
|
protected abstract int |
getInitialWait()
If the lock is already aquired, this returns the initial amount of milliseconds to wait.
|
protected abstract int |
getMaxWait()
Returns the maximal interval in millis which is spent until a new attempt is made to acquire a lock.
|
protected abstract int |
getWaitIncrement()
If the lock is still acquired, this returns the amount of milliseconds to increase the wait interval.
|
boolean |
tryLock(String lockName,
Duration acquireTimeout)
Tries to acquire the lock with the given name within the given interval.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocks, isLocked, unlockpublic boolean tryLock(@Nonnull String lockName, @Nullable Duration acquireTimeout)
LockManagertryLock in interface LockManagerlockName - the name of the lock to acquire.acquireTimeout - the max time to wait for a lock. Used null to immediatelly return if a lock
cannot
be obtained.protected abstract int getInitialWait()
protected abstract int getWaitIncrement()
protected abstract int getMaxWait()
protected abstract boolean acquireLock(String lockName)
lockName - the name of the lock to acquire.Copyright © 2018. All rights reserved.