|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.services.locks.LockControl
A LockControl contains a reference to the item being locked and doubly linked lists for the granted locks and the waiting locks.
MT - Mutable - Container object : single thread required
Field Summary | |
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
|
Constructor Summary | |
private |
LockControl(LockControl copyFrom)
|
protected |
LockControl(Lock firstLock,
Lockable ref)
|
Method Summary | |
Lock |
addLock(LockSet ls,
java.lang.Object compatabilitySpace,
java.lang.Object qualifier)
Add a lock into this control, granted it if possible. |
private void |
addWaiter(java.util.List waiting,
Lock lockItem,
LockSet ls)
Add a lock request to a list of waiters. |
void |
addWaiters(java.util.Dictionary waiters)
Add the waiters of this lock into this Dictionary 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(java.lang.Object compatabilitySpace,
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,
LockSet ls)
Get the next waiting lock (if any). |
java.util.List |
getWaiting()
|
protected void |
giveUpWait(java.lang.Object item,
LockSet ls)
Give up waiting up on a lock |
(package private) void |
grant(Lock lockItem)
Grant this lock. |
boolean |
isEmpty()
|
boolean |
isGrantable(boolean noWaitersBeforeMe,
java.lang.Object compatabilitySpace,
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(java.util.List waiting,
LockSet ls)
Remove and return the first lock request from a list of waiters. |
private java.lang.Object |
removeWaiter(java.util.List waiting,
int index,
LockSet ls)
Remove and return the lock request at the given index from a list of waiters. |
private int |
removeWaiter(java.util.List waiting,
java.lang.Object item,
LockSet 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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final Lockable ref
private Lock firstGrant
private java.util.List granted
private java.util.List waiting
private Lock lastPossibleSkip
Constructor Detail |
protected LockControl(Lock firstLock, Lockable ref)
private LockControl(LockControl copyFrom)
Method Detail |
public LockControl getLockControl()
getLockControl
in interface Control
public boolean isEmpty()
isEmpty
in interface Control
void grant(Lock lockItem)
public boolean unlock(Latch lockInGroup, int unlockCount)
unlock
in interface Control
public boolean isGrantable(boolean noWaitersBeforeMe, java.lang.Object compatabilitySpace, java.lang.Object qualifier)
isGrantable
in interface Control
public Lock addLock(LockSet ls, java.lang.Object compatabilitySpace, java.lang.Object qualifier)
protected boolean isUnlocked()
public ActiveLock firstWaiter()
firstWaiter
in interface Control
ActiveLock getNextWaiter(ActiveLock item, boolean remove, LockSet 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, LockSet ls)
public void addWaiters(java.util.Dictionary waiters)
addWaiters
in interface Control
java.util.List getGrants()
public final Lock getLock(java.lang.Object compatabilitySpace, java.lang.Object qualifier)
getLock
in interface Control
public Control shallowClone()
shallowClone
in interface Control
private void addWaiter(java.util.List waiting, Lock lockItem, LockSet ls)
waiting
- The list of waiters to add tolockItem
- The lock requestls
- The LockSetprivate java.lang.Object popFrontWaiter(java.util.List waiting, LockSet ls)
waiting
- The list of waiters to pop fromls
- The LockSet
private java.lang.Object removeWaiter(java.util.List waiting, int index, LockSet ls)
waiting
- The list of waiters to pop fromindex
- The index at which to remove the lock requestls
- The LockSet
private int removeWaiter(java.util.List waiting, java.lang.Object item, LockSet ls)
waiting
- The list of waiters to pop fromitem
- The item to removels
- The LockSet
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |