Class Lock
java.lang.Object
org.apache.derby.impl.services.locks.Lock
- Direct Known Subclasses:
ActiveLock
A Lock represents a granted or waiting lock request.
MT - Mutable - Immutable identity : Thread Aware
MT - Mutable - Immutable identity : Thread Aware
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Lock
(CompatibilitySpace space, Lockable ref, Object qualifier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWaiters
(Map waiters) (package private) final Lock
copy()
final boolean
final CompatibilitySpace
Return the compatibility space this lock is held in.final int
getCount()
Return the count of locks.getLock
(CompatibilitySpace compatibilitySpace, Object qualifier) final Lockable
Return the object this lock is held on MT - Thread safefinal Object
Return the qualifier lock was obtained with.(package private) void
grant()
final int
hashCode()
boolean
isEmpty()
boolean
isGrantable
(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, Object requestQualifier) We can return ourselves here because our identity is immutable and what we returned will not be accessed as a Lock, so the count cannot be changed.(package private) int
unlock
(int unlockCount) boolean
-
Field Details
-
space
Compatibility space the object is locked in. MT - immutable - reference only -
ref
Object being locked. MT - immutable - reference only -
qualifier
Qualifier used in the lock request.. MT - immutable - reference only -
count
int count
-
-
Constructor Details
-
Lock
-
-
Method Details
-
getLockable
Return the object this lock is held on MT - Thread safe- Specified by:
getLockable
in interfaceControl
- Specified by:
getLockable
in interfaceLatch
-
getCompatabilitySpace
Return the compatibility space this lock is held in. MT - Thread safe- Specified by:
getCompatabilitySpace
in interfaceLatch
-
getQualifier
Return the qualifier lock was obtained with. MT - Thread safe- Specified by:
getQualifier
in interfaceLatch
-
getCount
public final int getCount()Return the count of locks. MT - Thread safe -
copy
-
grant
void grant() -
unlock
int unlock(int unlockCount) -
hashCode
public final int hashCode() -
equals
-
getLockControl
- Specified by:
getLockControl
in interfaceControl
-
getLock
-
shallowClone
We can return ourselves here because our identity is immutable and what we returned will not be accessed as a Lock, so the count cannot be changed.- Specified by:
shallowClone
in interfaceControl
-
firstWaiter
- Specified by:
firstWaiter
in interfaceControl
-
isEmpty
public boolean isEmpty() -
unlock
-
addWaiters
- Specified by:
addWaiters
in interfaceControl
-
getFirstGrant
- Specified by:
getFirstGrant
in interfaceControl
-
getGranted
- Specified by:
getGranted
in interfaceControl
-
getWaiting
- Specified by:
getWaiting
in interfaceControl
-
isGrantable
public boolean isGrantable(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, Object requestQualifier) - Specified by:
isGrantable
in interfaceControl
-