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.SessionTreePathLockCount,SessionLock.SubsessionLockCount,SessionLock.UpwardSubtreeLockCount,SessionLock.UUIDLockCount
public interface LockCountManager<L>ALockCountManagerprovides 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 asdecreaseAndGetLockCount(Object)have to be implemented accordingly.- Author:
- Ulrich Kreher
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intdecreaseAndGetLockCount(L object)Decreases the number of times the designated object holds the lock.StringgetLockOwner()Returns a string representation of one object that currently has a lock.booleanhasLock(L object)Returns 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 Detail
-
hasLock
boolean hasLock(L object)
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
int increaseAndGetLockCount(L object)
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
int decreaseAndGetLockCount(L object)
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.
-
-