Class SessionLock.UpwardSubtreeLockCount
- java.lang.Object
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.AbstractLockCount
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.ChildSessionIDLockCount
-
- de.aristaflow.adept2.base.sessionmanagement.SessionLock.UpwardSubtreeLockCount
-
- All Implemented Interfaces:
LockCountManager<SessionToken>
- Enclosing class:
- SessionLock
public static class SessionLock.UpwardSubtreeLockCount extends SessionLock.ChildSessionIDLockCount
ALockCountManagerconsidering session tokens and their subsessions (but not vice versa!) as equal. This locks a specific subtree in the session token tree and therefore allows siblings (session tokens with a common parent below the locking root) to have the lock concurrently.
The subtree will be locked until the last (child) session has unlocked.In case multiple (read) locks are allowed, the root may move upward (in direction of the top-level) thus extending the subtree. In this case the nearest common ancestor of the existing root and the newly locking session will become the new root.
-
-
Constructor Summary
Constructors Constructor Description UpwardSubtreeLockCount()Creates a newLockCountManagerfor locking subtrees starting with a specific root which will only move upward.
-
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.
-
-