Interface LockCountManager<L>
- Type Parameters:
L- The type of objects of which the lock acquisitions are to be counted by this lock count manager (lock owning type).
- All Known Implementing Classes:
ObjectEqualityLockCount,SessionLock.AbstractLockCount,SessionLock.ChildSessionIDLockCount,SessionLock.DownwardSubtreeLockCount,SessionLock.SessionIdLockCount,SessionLock.UpwardSubtreeLockCount
public interface LockCountManager<L>
A
LockCountManager provides the means to manage reentrant
locks based on objects by counting lock acquisitions. This also
encapsulates how objects are compared. If two objects are to be equal,
hasLock(Object), increaseAndGetLockCount(Object) as well
as decreaseAndGetLockCount(Object) have to be implemented
accordingly.- Author:
- Ulrich Kreher
-
Method Summary
Modifier and TypeMethodDescriptionintdecreaseAndGetLockCount(L object) Decreases the number of times the designated object holds the lock.Returns a string representation of one object that currently has a lock.booleanReturns whether the designated object has a lock at least once.booleanhasLocks()Returns whether this lock count manager knows at least one object that has a lock.intincreaseAndGetLockCount(L object) Increases the number of times the designated object holds the lock.
-
Method Details
-
hasLock
Returns whether the designated object has a lock at least once.- Parameters:
object- The object which is checked whether it holds a lock.- Returns:
- Whether the designated object has a lock at least once.
-
hasLocks
boolean hasLocks()Returns whether this lock count manager knows at least one object that has a lock.- Returns:
- Whether at least one object has a lock.
-
getLockOwner
String getLockOwner()Returns a string representation of one object that currently has a lock. This can be used for user information or tracking purpose. A locking object may not be returned since this would allow to unlock.- Returns:
- A string representation of one object that currently has a lock.
-
increaseAndGetLockCount
Increases the number of times the designated object holds the lock.- Parameters:
object- The object which has acquired the lock (once again).- Returns:
- The number of times the designated object has the lock after the increment.
-
decreaseAndGetLockCount
Decreases the number of times the designated object holds the lock. If the object does not hold the lock, the decrement will be ignored.- Parameters:
object- The object which has released the lock (once again).- Returns:
- The number of times the designated object has the lock after the decrement.
-