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
ConstructorsModifierConstructorDescriptionprotectedLock(CompatibilitySpace space, Lockable ref, Object qualifier) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWaiters(Map waiters) (package private) final Lockcopy()final booleanfinal CompatibilitySpaceReturn the compatibility space this lock is held in.final intgetCount()Return the count of locks.getLock(CompatibilitySpace compatibilitySpace, Object qualifier) final LockableReturn the object this lock is held on MT - Thread safefinal ObjectReturn the qualifier lock was obtained with.(package private) voidgrant()final inthashCode()booleanisEmpty()booleanisGrantable(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) intunlock(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:
getLockablein interfaceControl- Specified by:
getLockablein interfaceLatch
-
getCompatabilitySpace
Return the compatibility space this lock is held in. MT - Thread safe- Specified by:
getCompatabilitySpacein interfaceLatch
-
getQualifier
Return the qualifier lock was obtained with. MT - Thread safe- Specified by:
getQualifierin 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:
getLockControlin 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:
shallowClonein interfaceControl
-
firstWaiter
- Specified by:
firstWaiterin interfaceControl
-
isEmpty
public boolean isEmpty() -
unlock
-
addWaiters
- Specified by:
addWaitersin interfaceControl
-
getFirstGrant
- Specified by:
getFirstGrantin interfaceControl
-
getGranted
- Specified by:
getGrantedin interfaceControl
-
getWaiting
- Specified by:
getWaitingin interfaceControl
-
isGrantable
public boolean isGrantable(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, Object requestQualifier) - Specified by:
isGrantablein interfaceControl
-