|
|||||||||
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
final class 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(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)
|
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, 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)
getLock
in interface Control
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 table
private java.lang.Object removeWaiter(int index, LockTable ls)
index
- The index at which to remove the lock requestls
- The lock table
private int removeWaiter(java.lang.Object item, LockTable ls)
item
- The item to removels
- The lock table
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |