public class ThreadLock extends ReentrantLock<java.lang.Thread>
ObjectEqualityLockCount together with this class, one has the
same behaviour as ReentrantReadWriteLock. ReentrantLock<Thread>.class).ReentrantLock.Lock, ReentrantLock.ReadLock, ReentrantLock.WriteLocklogger, notification, readLock, writeLock| Constructor and Description |
|---|
ThreadLock(boolean exclusive,
java.util.logging.Logger logger)
Creates a new
ThreadLock resembling
ReentrantReadWriteLock in non-exclusive
mode, that is, it is based on threads, it uses
Object.equals(Object) and is either exclusive or it supports
(non-exclusive) readers and (exclusive) writers. |
ThreadLock(java.lang.Class<? extends LockCountManager<java.lang.Thread>> lockCountManager,
boolean exclusive,
LockNotification<java.lang.Thread> notification,
java.util.logging.Logger logger)
Creates a new
ThreadLock using the designated lock count
manager and the designated exclusive mode. |
ThreadLock(java.lang.Class<? extends LockCountManager<java.lang.Thread>> lockCountManager,
boolean exclusive,
java.util.logging.Logger logger)
Creates a new
ThreadLock using the designated lock count
manager and the designated exclusive mode. |
ThreadLock(java.util.logging.Logger logger)
Creates a new
ThreadLock resembling
ReentrantLock, that is, it is based on
threads, it uses Object.equals(Object) and it is exclusive. |
isReadLocked, isWriteLocked, readLock, writeLockpublic ThreadLock(java.util.logging.Logger logger)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
ThreadLock resembling
ReentrantLock, that is, it is based on
threads, it uses Object.equals(Object) and it is exclusive.logger - The logger for log messages.java.lang.InstantiationException - Should never happen. If the object equality
lock count manager cannot be instantiated or does not have a
parameterless constructor, an InstantiationException
will be thrown.java.lang.IllegalAccessException - Should never happen. If the object equality
lock count manager class or its constructor is not accessible, an
IllegalAccessException will be thrown.public ThreadLock(boolean exclusive,
java.util.logging.Logger logger)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
ThreadLock resembling
ReentrantReadWriteLock in non-exclusive
mode, that is, it is based on threads, it uses
Object.equals(Object) and is either exclusive or it supports
(non-exclusive) readers and (exclusive) writers.exclusive - Whether to create an exclusive lock or a read/write-lock.logger - The logger for log messages.java.lang.InstantiationException - Should never happen. If the object equality
lock count manager cannot be instantiated or does not have a
parameterless constructor, an InstantiationException
will be thrown.java.lang.IllegalAccessException - Should never happen. If the object equality
lock count manager class or its constructor is not accessible, an
IllegalAccessException will be thrown.public ThreadLock(java.lang.Class<? extends LockCountManager<java.lang.Thread>> lockCountManager, boolean exclusive, java.util.logging.Logger logger) throws java.lang.InstantiationException, java.lang.IllegalAccessException
ThreadLock using the designated lock count
manager and the designated exclusive mode. This constructor is for usage by
ObjectLockManager.lockCountManager - The manager counting locks for threads. 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 ThreadLock(java.lang.Class<? extends LockCountManager<java.lang.Thread>> lockCountManager, boolean exclusive, LockNotification<java.lang.Thread> notification, java.util.logging.Logger logger) throws java.lang.InstantiationException, java.lang.IllegalAccessException
ThreadLock using the designated lock count
manager and the designated exclusive mode. 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. This constructor is for usage by
ObjectLockManager.lockCountManager - The manager counting locks for threads. 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.