O - The type of the objects to be locked (locked object type).L - The type of the objects that lock (lock owning type).protected static class OptimisticObjectLockManager.LockRemover<O,L> extends java.lang.Object implements LockNotification<L>
| Modifier and Type | Field and Description |
|---|---|
protected O |
lockedObject
The locked object.
|
protected java.util.logging.Logger |
logger
The logger for logging lock acquisitions and releasing - great for
debugging purpose.
|
protected java.util.concurrent.ConcurrentMap<O,ReentrantLock<L>> |
objectLocks
A mapping from the locked object to the corresponding lock.
|
| Modifier | Constructor and Description |
|---|---|
protected |
LockRemover(java.util.concurrent.ConcurrentMap<O,ReentrantLock<L>> objectLocks,
O lockedObject,
java.util.logging.Logger logger)
Creates a new remover for removing the lock from the internal map
containing all locked objects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
locked(ReentrantLock<L> reLock,
boolean writeLock,
L lockingObject,
int lockCount)
Signals that the designated reentrant lock has been locked by the
designated object for the designated number of times.
|
void |
unlocked(ReentrantLock<L> reLock,
boolean writeLock,
boolean isLocked,
boolean waitersForLock,
L lockingObject,
int lockCount)
Signals that the designated reentrant lock has been unlocked and provides
the number of times the lock is still held by the designated object.
|
protected final java.util.logging.Logger logger
protected final O lockedObject
protected final java.util.concurrent.ConcurrentMap<O,ReentrantLock<L>> objectLocks
protected LockRemover(java.util.concurrent.ConcurrentMap<O,ReentrantLock<L>> objectLocks, O lockedObject, java.util.logging.Logger logger)
objectLocks - The mapping of the locked object to the corresponding
lock from which to remove the lock after the last unlock.lockedObject - The locked object.logger - The logger for logging lock acquisitions and releasing -
great for debugging purpose.public void locked(ReentrantLock<L> reLock, boolean writeLock, L lockingObject, int lockCount)
LockNotificationlocked in interface LockNotification<L>reLock - The lock which has been acquired (or rather is currently
being acquired since the notification takes place while locking).writeLock - Whether the designated lock has been/is currently write
locked. An exclusive lock is always write locked.lockingObject - The object which has acquired the lock for the
designated number of times.lockCount - The number of times the lock the lock is currently being
held by the current locking object. In case of a read lock there
may be additional locks by other objects!public void unlocked(ReentrantLock<L> reLock, boolean writeLock, boolean isLocked, boolean waitersForLock, L lockingObject, int lockCount)
LockNotificationunlocked in interface LockNotification<L>reLock - The lock which has been released (or rather is currently
being released since the notification takes place while
unlocking).writeLock - Whether the designated lock has been/is currently unlocked
from writing. An exclusive lock is always write locked.isLocked - Whether the designated lock is still being held by the
designated locking object and/or by others.waitersForLock - Whether there are objects waiting for the designated
lock.lockingObject - The object which has released the lock and still helds
it for the designated number of times.lockCount - The number of times the lock the lock is still held by the
designated locking object after the current unlocking.