Modifier and Type | Field and Description |
---|---|
private Lock |
firstGrant
This lock control uses an optimistic locking scheme.
|
private java.util.List |
granted |
private Lock |
lastPossibleSkip |
private Lockable |
ref |
private java.util.List |
waiting |
Modifier | Constructor and Description |
---|---|
private |
LockControl(LockControl copyFrom) |
protected |
LockControl(Lock firstLock,
Lockable ref) |
Modifier and Type | Method and 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 waiters)
Add the waiters of this lock into this Map object.
|
ActiveLock |
firstWaiter()
Return the first lock in the wait line, null if the
line is empty.
|
Lock |
getFirstGrant() |
java.util.List |
getGranted() |
(package private) java.util.List |
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 |
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 granted
private java.util.List waiting
private Lock lastPossibleSkip
private LockControl(LockControl copyFrom)
public LockControl getLockControl()
getLockControl
in interface Control
void grant(Lock lockItem)
public boolean unlock(Latch lockInGroup, int unlockCount)
public boolean isGrantable(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, java.lang.Object qualifier)
isGrantable
in interface Control
public Lock addLock(LockTable ls, CompatibilitySpace compatibilitySpace, java.lang.Object qualifier)
protected boolean isUnlocked()
public ActiveLock firstWaiter()
firstWaiter
in interface Control
ActiveLock getNextWaiter(ActiveLock item, boolean remove, LockTable ls)
public Lockable getLockable()
getLockable
in interface Control
public Lock getFirstGrant()
getFirstGrant
in interface Control
public java.util.List getGranted()
getGranted
in interface Control
public java.util.List getWaiting()
getWaiting
in interface Control
protected void giveUpWait(java.lang.Object item, LockTable ls)
public void addWaiters(java.util.Map waiters)
addWaiters
in interface Control
java.util.List getGrants()
public final Lock getLock(CompatibilitySpace compatibilitySpace, java.lang.Object qualifier)
public Control shallowClone()
shallowClone
in interface Control
private 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.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.