MT - Mutable - Container object : single thread required
| Modifier and Type | Field and Description |
|---|---|
| private Lock | firstGrant
This lock control uses an optimistic locking scheme. |
| private List | |
| private Lock | |
| private final Lockable | |
| private List |
| Access | Constructor and Description |
|---|---|
| protected | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Lock | addLock(LockTable ls, CompatibilitySpace compatibilitySpace, Object qualifier)
Add a lock into this control, granted it if possible. |
| private void | |
| public void | addWaiters(Map<Object, Object> waiters)
Implements org. Add the waiters of this lock into this Map object. |
| public boolean | blockedByParent(Lock childLock)
Returns true if the childLock is blocked because its parent owns a conficting lock. |
| public ActiveLock | firstWaiter()
Implements org. Return the first lock in the wait line, null if the line is empty. |
| public Lock | |
| public List | |
| pack-priv List | |
| public final Lock | getLock(CompatibilitySpace compatibilitySpace, Object qualifier)
Implements org. Find a granted lock matching this space and qualifier |
| public Lockable | getLockable()
Implements org. Return the lockable object controlled by me. |
| public LockControl | |
| pack-priv ActiveLock | |
| public List | |
| protected void | |
| pack-priv void | |
| public boolean | |
| public boolean | isGrantable(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, Object qualifier)
Implements org. This routine can be called to see if a lock currently on the wait list could be granted. |
| protected boolean | |
| private Object | Returns: The removed lock requestThe lock table ls)Remove and return the first lock request from a list of waiters. |
| private Object | Returns: The removed lock requestThe index at which to remove the lock request index, LockTable The lock table ls)Remove and return the lock request at the given index from a list of waiters. |
| private int | Returns: The number of items removedThe item to remove item, LockTable The lock table ls)Remove and return the given lock request from a list of waiters. |
| public Control | shallowClone()
Implements org. make a shallow clone of myself |
| public boolean | unlock(Latch lockInGroup, int unlockCount)
Implements org.
|
| firstGrant | back to summary |
|---|---|
| private Lock firstGrant This lock control uses an optimistic locking scheme. When the first lock on an object is granted it simply sets firstGrant to be that object, removing the need to allocate a list if no other locks are granted before the first lock is release. If a second lock is granted then a list is allocated and the firstGrant lock is moved into the list. Once a list has been created it is always used. | |
| granted | back to summary |
|---|---|
| private List<Lock> granted | |
| lastPossibleSkip | back to summary |
|---|---|
| private Lock lastPossibleSkip | |
| ref | back to summary |
|---|---|
| private final Lockable ref | |
| waiting | back to summary |
|---|---|
| private List<Lock> waiting | |
| LockControl | back to summary |
|---|---|
| protected LockControl(Lock firstLock, Lockable ref) | |
| LockControl | back to summary |
|---|---|
| private LockControl(LockControl copyFrom) | |
| addLock | back to summary |
|---|---|
| public Lock addLock(LockTable ls, CompatibilitySpace compatibilitySpace, Object qualifier) Add a lock into this control, granted it if possible. This can be entered in several states. | |
| addWaiter | back to summary |
|---|---|
| private void addWaiter(Lock lockItem, LockTable ls) Add a lock request to a list of waiters. | |
| addWaiters | back to summary |
|---|---|
| public void addWaiters(Map<Object, Object> waiters) Implements org. Add the waiters of this lock into this Map object.
| |
| blockedByParent | back to summary |
|---|---|
| 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. | |
| firstWaiter | back to summary |
|---|---|
| public ActiveLock firstWaiter() Implements org. Return the first lock in the wait line, null if the line is empty. | |
| getFirstGrant | back to summary |
|---|---|
| public Lock getFirstGrant() Implements org. | |
| getGranted | back to summary |
|---|---|
| public List Implements org. | |
| getGrants | back to summary |
|---|---|
| pack-priv List Return a Stack of the held locks (Lock objects) on this Lockable. | |
| getLock | back to summary |
|---|---|
| public final Lock getLock(CompatibilitySpace compatibilitySpace, Object qualifier) Implements org. Find a granted lock matching this space and qualifier | |
| getLockable | back to summary |
|---|---|
| public Lockable getLockable() Implements org. Return the lockable object controlled by me. | |
| getLockControl | back to summary |
|---|---|
| public LockControl getLockControl() Implements org. | |
| getNextWaiter | back to summary |
|---|---|
| pack-priv ActiveLock getNextWaiter(ActiveLock item, boolean remove, LockTable ls) Get the next waiting lock (if any). | |
| getWaiting | back to summary |
|---|---|
| public List Implements org. | |
| giveUpWait | back to summary |
|---|---|
| protected void giveUpWait(Object item, LockTable ls) Give up waiting up on a lock | |
| grant | back to summary |
|---|---|
| pack-priv void grant(Lock lockItem) Grant this lock. | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements org. | |
| isGrantable | back to summary |
|---|---|
| public boolean isGrantable(boolean noWaitersBeforeMe, CompatibilitySpace compatibilitySpace, Object qualifier) Implements org. 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 | back to summary |
|---|---|
| protected boolean isUnlocked() | |
| popFrontWaiter | back to summary |
|---|---|
| private Object popFrontWaiter(LockTable ls) Remove and return the first lock request from a list of waiters. | |
| removeWaiter | back to summary |
|---|---|
| private Object removeWaiter(int index, LockTable ls) Remove and return the lock request at the given index from a list of waiters. | |
| removeWaiter | back to summary |
|---|---|
| private int removeWaiter(Object item, LockTable ls) Remove and return the given lock request from a list of waiters. | |
| shallowClone | back to summary |
|---|---|
| public Control shallowClone() Implements org. make a shallow clone of myself | |
| unlock | back to summary |
|---|---|
| public boolean unlock(Latch lockInGroup, int unlockCount) Implements org. | |