public class SessionLock extends ReentrantLock<SessionToken>
This session lock supports the consideration of subsessions. They may either be considered as equal to a parent session or not with regard to a lock. If you do not want to treat subsessions as equal, attend particularly to deadlocks!
ReentrantReadWriteLock| Modifier and Type | Class and Description |
|---|---|
static class |
SessionLock.ChildSessionIDLockCount
A
LockCountManager counting session tokens with an equality
based on child session IDs. |
static class |
SessionLock.SessionTreePathLockCount
A
LockCountManager counting session tokens considering session
tokens and their subsessions (but not vice versa!) |
static class |
SessionLock.SubsessionLockCount
A
LockCountManager counting session tokens considering session
tokens and their subsessions (but not vice versa!) |
static class |
SessionLock.UUIDLockCount
A
LockCountManager counting session tokens with an equality
based on their UUIDs (of the corresponding top-level session token). |
ReentrantLock.Lock, ReentrantLock.ReadLock, ReentrantLock.WriteLocklogger, notification, readLock, writeLock| Constructor and Description |
|---|
SessionLock(java.lang.Class<? extends LockCountManager<SessionToken>> lockCountManager,
boolean exclusive,
LockNotification<SessionToken> notification,
java.util.logging.Logger logger)
Creates either a new exclusive lock or a new read/write-lock and using the
designated
LockCountManager for counting locks as well as
comparing objects. |
SessionLock(java.lang.Class<? extends LockCountManager<SessionToken>> lockCountManager,
boolean exclusive,
java.util.logging.Logger logger)
Creates either a new exclusive lock or a new read/write-lock and using
the designated
LockCountManager for counting locks as well as
comparing sessions. |
SessionLock(LockCountManager<SessionToken> writeLockCountManager,
LockCountManager<SessionToken> readLockCountManager,
LockNotification<SessionToken> notification,
java.util.logging.Logger logger)
Creates either a new exclusive lock or a new read/write-lock and using the
LockCountManager for counting locks as well as comparing
objects. |
SessionLock(LockCountManager<SessionToken> lockCountManager,
LockNotification<SessionToken> notification,
java.util.logging.Logger logger)
Creates a new exclusive lock using the designated
LockCountManager for counting locks as well as comparing
objects. |
SessionLock(LockCountManager<SessionToken> lockCountManager,
java.util.logging.Logger logger)
Creates a new exclusive lock using the designated
LockCountManager for counting locks as well as comparing
objects. |
isReadLocked, isWriteLocked, readLock, writeLockpublic SessionLock(java.lang.Class<? extends LockCountManager<SessionToken>> lockCountManager, boolean exclusive, java.util.logging.Logger logger) throws java.lang.InstantiationException, java.lang.IllegalAccessException
LockCountManager for counting locks as well as
comparing sessions.lockCountManager - The manager counting locks for sessions. The
provided class needs an accessible (public) constructor without
parameters.exclusive - Whether to create an exclusive lock or a read/write-lock.logger - The logger for log messages.java.lang.InstantiationException - If the designated lock count manager class
cannot be instantiated or does not have a parameterless
constructor, an InstantiationException will be
thrown.java.lang.IllegalAccessException - If the designated lock count manager class
or its constructor is not accessible, an
IllegalAccessException will be thrown.public SessionLock(java.lang.Class<? extends LockCountManager<SessionToken>> lockCountManager, boolean exclusive, LockNotification<SessionToken> notification, java.util.logging.Logger logger) throws java.lang.InstantiationException, java.lang.IllegalAccessException
LockCountManager for counting locks as well as
comparing objects. The designated notification will be used for notifying a
successful lock or unlock while locking and unlocking, that is, the
notification will be atomically with respect to locking/unlocking.lockCountManager - The manager counting locks for objects. The
provided class needs an accessible (public) constructor without
parameters.exclusive - Whether to create an exclusive lock or a read/write-lock.notification - The notification to call directly but atomically after
locking and unlocking. If this is null, no
notification will be sent.logger - The logger for log messages.java.lang.InstantiationException - If the designated lock count manager class
cannot be instantiated or does not have a parameterless
constructor, an InstantiationException will be
thrown.java.lang.IllegalAccessException - If the designated lock count manager class
or its constructor is not accessible, an
IllegalAccessException will be thrown.public SessionLock(LockCountManager<SessionToken> lockCountManager, java.util.logging.Logger logger)
LockCountManager for counting locks as well as comparing
objects.lockCountManager - The manager counting locks for objects.logger - The logger for log messages.public SessionLock(LockCountManager<SessionToken> lockCountManager, LockNotification<SessionToken> notification, java.util.logging.Logger logger)
LockCountManager for counting locks as well as comparing
objects. The designated notification will be used for notifying a
successful lock or unlock while locking and unlocking, that is, the
notification will be atomically with respect to locking/unlocking.lockCountManager - The manager counting locks for objects.notification - The notification to call directly but atomically after
locking and unlocking. If this is null, no
notification will be sent.logger - The logger for log messages.public SessionLock(LockCountManager<SessionToken> writeLockCountManager, LockCountManager<SessionToken> readLockCountManager, LockNotification<SessionToken> notification, java.util.logging.Logger logger)
LockCountManager for counting locks as well as comparing
objects. If there is no lock count manager for the read lock or it equals
the lock count manager for the write lock, an exclusive lock will be
created, otherwise this will be read/write-lock. writeLockCountManager - The manager counting write locks for objects.readLockCountManager - The manager counting read locks for objects. If
this is null or equals the
writeLockCountManager, an exclusive lock will be
created.notification - The notification to call directly but atomically after
locking and unlocking. If this is null, no
notification will be sent.logger - The logger for log messages.