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
ALockCountManager
considering session tokens and their subsessions (but not vice versa!) as equal. This resemblesSessionLock.UpwardSubtreeLockCount
but 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 newLockCountManager
for 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 int
decreaseAndGetLockCount(SessionToken session)
Decreases the number of times the designated object holds the lock.boolean
hasLock(SessionToken session)
Returns whether the designated object has a lock at least once.int
increaseAndGetLockCount(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:LockCountManager
Returns whether the designated object has a lock at least once.- Specified by:
hasLock
in interfaceLockCountManager<SessionToken>
- Overrides:
hasLock
in 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:LockCountManager
Increases the number of times the designated object holds the lock.- Specified by:
increaseAndGetLockCount
in interfaceLockCountManager<SessionToken>
- Overrides:
increaseAndGetLockCount
in 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: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<SessionToken>
- Overrides:
decreaseAndGetLockCount
in 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.
-
-