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
ALockCountManager
considering 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 newLockCountManager
for 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 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.
-
-