Class SessionLock.DownwardSubtreeLockCount
- java.lang.Object
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.AbstractLockCount
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.ChildSessionIDLockCount
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.DownwardSubtreeLockCount
-
- All Implemented Interfaces:
LockCountManager<SessionToken>
- Enclosing class:
- SessionLock
public static class SessionLock.DownwardSubtreeLockCount extends SessionLock.ChildSessionIDLockCount
ALockCountManagerconsidering session tokens and their subsessions (but not vice versa!) as equal. This resemblesSessionLock.UpwardSubtreeLockCountbut differs in that additional locking sessions move a subtree downwards. This prevents sibling sessions from locking concurrently but only allows for consecutive sibling locking. Locking by parent sessions (ones lying on the way from a root to the top-level session) is allowed.
The subtree will be locked until the last (child) session has unlocked.The root of a subtree will always be the locking session token with the highest child level. When locking a subtree will move downward if locked by a descendant session and it will move upward in case a current root unlocks.
-
-
Constructor Summary
Constructors Constructor Description DownwardSubtreeLockCount()Creates a newLockCountManagerfor locking subtrees starting with a specific root which will move downward in case descendant sessions lock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdecreaseAndGetLockCount(SessionToken session)Decreases the number of times the designated object holds the lock.booleanhasLock(SessionToken session)Returns whether the designated object has a lock at least once.intincreaseAndGetLockCount(SessionToken session)Increases the number of times the designated object holds the lock.-
Methods inherited from class de.aristaflow.adept2.base.sessionmanagement.SessionLock.AbstractLockCount
getLockOwner, hasLocks
-
-
-
-
Method Detail
-
hasLock
public boolean hasLock(SessionToken session)
Description copied from interface:LockCountManagerReturns whether the designated object has a lock at least once.- Specified by:
hasLockin interfaceLockCountManager<SessionToken>- Overrides:
hasLockin classSessionLock.AbstractLockCount- Parameters:
session- The object which is checked whether it holds a lock.- Returns:
- Whether the designated object has a lock at least once.
-
increaseAndGetLockCount
public int increaseAndGetLockCount(SessionToken session)
Description copied from interface:LockCountManagerIncreases the number of times the designated object holds the lock.- Specified by:
increaseAndGetLockCountin interfaceLockCountManager<SessionToken>- Overrides:
increaseAndGetLockCountin classSessionLock.AbstractLockCount- Parameters:
session- 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(SessionToken session)
Description copied from interface:LockCountManagerDecreases 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:
decreaseAndGetLockCountin interfaceLockCountManager<SessionToken>- Overrides:
decreaseAndGetLockCountin classSessionLock.AbstractLockCount- Parameters:
session- The object which has released the lock (once again).- Returns:
- The number of times the designated object has the lock after the decrement.
-
-