Class ObjectEqualityLockCount
- java.lang.Object
-
- de.aristaflow.adept2.util.ObjectCounting<Object>
-
- de.aristaflow.adept2.util.locking.ObjectEqualityLockCount
-
- All Implemented Interfaces:
LockCountManager<Object>
public class ObjectEqualityLockCount extends ObjectCounting<Object> implements LockCountManager<Object>
- Author:
- Ulrich Kreher
-
-
Field Summary
-
Fields inherited from class de.aristaflow.adept2.util.ObjectCounting
logger, objectCount
-
-
Constructor Summary
Constructors Constructor Description ObjectEqualityLockCount()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
decreaseAndGetLockCount(Object object)
Decreases the number of times the designated object holds the lock.String
getLockOwner()
Returns a string representation of one object that currently has a lock.boolean
hasLock(Object object)
Returns whether the designated object has a lock at least once.boolean
hasLocks()
Returns whether this lock count manager knows at least one object that has a lock.int
increaseAndGetLockCount(Object object)
Increases the number of times the designated object holds the lock.-
Methods inherited from class de.aristaflow.adept2.util.ObjectCounting
decreaseAndGetCount, getCount, increaseAndGetCount, isEmpty
-
-
-
-
Method Detail
-
hasLock
public boolean hasLock(Object object)
Description copied from interface:LockCountManager
Returns whether the designated object has a lock at least once.- Specified by:
hasLock
in interfaceLockCountManager<Object>
- Parameters:
object
- The object which is checked whether it holds a lock.- Returns:
- Whether the designated object has a lock at least once.
-
hasLocks
public boolean hasLocks()
Description copied from interface:LockCountManager
Returns whether this lock count manager knows at least one object that has a lock.- Specified by:
hasLocks
in interfaceLockCountManager<Object>
- Returns:
- Whether at least one object has a lock.
-
getLockOwner
public String getLockOwner()
Description copied from interface:LockCountManager
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.- Specified by:
getLockOwner
in interfaceLockCountManager<Object>
- Returns:
- A string representation of one object that currently has a lock.
-
increaseAndGetLockCount
public int increaseAndGetLockCount(Object object)
Description copied from interface:LockCountManager
Increases the number of times the designated object holds the lock.- Specified by:
increaseAndGetLockCount
in interfaceLockCountManager<Object>
- 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
public int decreaseAndGetLockCount(Object object)
Description copied from interface:LockCountManager
Decreases the number of times the designated object holds the lock. If the object does not hold the lock, the decrement will be ignored.- Specified by:
decreaseAndGetLockCount
in interfaceLockCountManager<Object>
- 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.
-
-