| java.lang.Object org.apache.derby.impl.services.locks.LockControl
LockControl | public class LockControl implements Control(Code) | | 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
|
Method Summary | |
public Lock | addLock(LockSet ls, Object compatabilitySpace, Object qualifier) Add a lock into this control, granted it if possible.
This can be entered in several states.
The Lockable is locked (granted queue not empty), and there are no waiters (waiting queue is empty)
The Lockable is locked and there are waiters
The Lockable is locked and there are waiters and the first is potentially granted
The Lockable is unlocked and there are waiters and the first is potentially granted. | public void | addWaiters(Dictionary waiters) Add the waiters of this lock into this Dictionary object. | public ActiveLock | firstWaiter() Return the first lock in the wait line, null if the
line is empty. | public Lock | getFirstGrant() | public List | getGranted() | List | getGrants() Return a Stack of the
held locks (Lock objects) on this Lockable. | final public Lock | getLock(Object compatabilitySpace, Object qualifier) | public LockControl | getLockControl() | public Lockable | getLockable() Return the lockable object controlled by me. | ActiveLock | getNextWaiter(ActiveLock item, boolean remove, LockSet ls) Get the next waiting lock (if any). | public List | getWaiting() | protected void | giveUpWait(Object item, LockSet ls) | void | grant(Lock lockItem) Grant this lock. | public boolean | isEmpty() | public boolean | isGrantable(boolean noWaitersBeforeMe, Object compatabilitySpace, Object qualifier) This routine can be called to see if a lock currently on the wait
list could be granted. | protected boolean | isUnlocked() | public Control | shallowClone() | public boolean | unlock(Latch lockInGroup, int unlockCount) |
addLock | public Lock addLock(LockSet ls, Object compatabilitySpace, Object qualifier)(Code) | | Add a lock into this control, granted it if possible.
This can be entered in several states.
The Lockable is locked (granted queue not empty), and there are no waiters (waiting queue is empty)
The Lockable is locked and there are waiters
The Lockable is locked and there are waiters and the first is potentially granted
The Lockable is unlocked and there are waiters and the first is potentially granted. Logically the item is
still locked, it's just that the lock has just been released and the first waker has not woken up yet.
This call is never entered when the object is unlocked and there are no waiters.
1) The Lockable has just been unlocked,
|
addWaiters | public void addWaiters(Dictionary waiters)(Code) | | Add the waiters of this lock into this Dictionary object.
Each waiting thread gets two entries in the hashtable
- key=compatibility space - value=ActiveLock
- key=ActiveLock - value={LockControl for first waiter|ActiveLock of previosue waiter}
|
firstWaiter | public ActiveLock firstWaiter()(Code) | | Return the first lock in the wait line, null if the
line is empty.
|
getGrants | List getGrants()(Code) | | Return a Stack of the
held locks (Lock objects) on this Lockable.
|
getLock | final public Lock getLock(Object compatabilitySpace, Object qualifier)(Code) | | Find a granted lock matching this space and qualifier
|
getLockable | public Lockable getLockable()(Code) | | Return the lockable object controlled by me.
|
giveUpWait | protected void giveUpWait(Object item, LockSet ls)(Code) | | Give up waiting up on a lock
|
grant | void grant(Lock lockItem)(Code) | | Grant this lock.
|
isEmpty | public boolean isEmpty()(Code) | | |
isGrantable | public boolean isGrantable(boolean noWaitersBeforeMe, Object compatabilitySpace, Object qualifier)(Code) | | This routine can be called to see if a lock currently on the wait
list could be granted. If this lock has waiters ahead of it
then we do not jump over the waiter(s) even if we can be granted.
This avoids the first waiter being starved out.
|
isUnlocked | protected boolean isUnlocked()(Code) | | |
shallowClone | public Control shallowClone()(Code) | | make a shallow clone of myself
|
unlock | public boolean unlock(Latch lockInGroup, int unlockCount)(Code) | | |
|
|