| Modifier and Type | Field | Description |
|---|---|---|
private Lock |
firstGrant |
This lock control uses an optimistic locking scheme.
|
private java.util.List<Lock> |
granted |
|
private Lock |
lastPossibleSkip |
|
private Lockable |
ref |
|
private java.util.List<Lock> |
waiting |
| Modifier | Constructor | Description |
|---|---|---|
private |
LockControl(LockControl copyFrom) |
|
protected |
LockControl(Lock firstLock,
Lockable ref) |
| Modifier and Type | Method | Description |
|---|---|---|
Lock |
addLock(LockTable ls,
CompatibilitySpace compatibilitySpace,
java.lang.Object qualifier) |
Add a lock into this control, granted it if possible.
|
private void |
addWaiter(Lock lockItem,
LockTable ls) |
Add a lock request to a list of waiters.
|
void |
addWaiters(java.util.Map<java.lang.Object,java.lang.Object> waiters) |
Add the waiters of this lock into this Map object.
|
boolean |
blockedByParent(Lock childLock) |
Returns true if the childLock is blocked because its parent owns
a conficting lock.
|
ActiveLock |
firstWaiter() |
Return the first lock in the wait line, null if the
line is empty.
|
Lock |
getFirstGrant() |
|
java.util.List<Lock> |
getGranted() |
|
(package private) java.util.List<Lock> |
getGrants() |
Return a Stack of the
held locks (Lock objects) on this Lockable.
|
Lock |
getLock(CompatibilitySpace compatibilitySpace,
java.lang.Object qualifier) |
Find a granted lock matching this space and qualifier
|
Lockable |
getLockable() |
Return the lockable object controlled by me.
|
LockControl |
getLockControl() |
|
(package private) ActiveLock |
getNextWaiter(ActiveLock item,
boolean remove,
LockTable ls) |
Get the next waiting lock (if any).
|
java.util.List<Lock> |
getWaiting() |
|
protected void |
giveUpWait(java.lang.Object item,
LockTable ls) |
Give up waiting up on a lock
|
(package private) void |
grant(Lock lockItem) |
Grant this lock.
|
boolean |
isEmpty() |
|
boolean |
isGrantable(boolean noWaitersBeforeMe,
CompatibilitySpace compatibilitySpace,
java.lang.Object qualifier) |
This routine can be called to see if a lock currently on the wait
list could be granted.
|
protected boolean |
isUnlocked() |
|
private java.lang.Object |
popFrontWaiter(LockTable ls) |
Remove and return the first lock request from a list of waiters.
|
private java.lang.Object |
removeWaiter(int index,
LockTable ls) |
Remove and return the lock request at the given index
from a list of waiters.
|
private int |
removeWaiter(java.lang.Object item,
LockTable ls) |
Remove and return the given lock request from a list of waiters.
|
Control |
shallowClone() |
make a shallow clone of myself
|
boolean |
unlock(Latch lockInGroup,
int unlockCount) |
private final Lockable ref
private Lock firstGrant
private java.util.List<Lock> granted
private java.util.List<Lock> waiting
private Lock lastPossibleSkip
private LockControl(LockControl copyFrom)
public LockControl getLockControl()
getLockControl in interface Controlvoid grant(Lock lockItem)
public boolean unlock(Latch lockInGroup, int unlockCount)
public boolean isGrantable(boolean noWaitersBeforeMe,
CompatibilitySpace compatibilitySpace,
java.lang.Object qualifier)
isGrantable in interface Controlpublic Lock addLock(LockTable ls, CompatibilitySpace compatibilitySpace, java.lang.Object qualifier)
protected boolean isUnlocked()
public ActiveLock firstWaiter()
firstWaiter in interface ControlActiveLock getNextWaiter(ActiveLock item, boolean remove, LockTable ls)
public Lockable getLockable()
getLockable in interface Controlpublic Lock getFirstGrant()
getFirstGrant in interface Controlpublic java.util.List<Lock> getGranted()
getGranted in interface Controlpublic java.util.List<Lock> getWaiting()
getWaiting in interface Controlprotected void giveUpWait(java.lang.Object item,
LockTable ls)
public void addWaiters(java.util.Map<java.lang.Object,java.lang.Object> waiters)
addWaiters in interface Controljava.util.List<Lock> getGrants()
public final Lock getLock(CompatibilitySpace compatibilitySpace, java.lang.Object qualifier)
public boolean blockedByParent(Lock childLock)
Returns true if the childLock is blocked because its parent owns a conficting lock. This code was written to support the fix to DERBY-6554. The only known way that this condition arises is when a write attempt by a nested user transaction is blocked by a read lock held by the main transaction. This only happens while trying to write to SYS.SYSSEQUENCES while managing sequence generators.
public Control shallowClone()
shallowClone in interface Controlprivate void addWaiter(Lock lockItem, LockTable ls)
lockItem - The lock requestls - The lock tableprivate java.lang.Object popFrontWaiter(LockTable ls)
ls - The lock tableprivate java.lang.Object removeWaiter(int index,
LockTable ls)
index - The index at which to remove the lock requestls - The lock tableprivate int removeWaiter(java.lang.Object item,
LockTable ls)
item - The item to removels - The lock tableApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.