@InterfaceAudience.Private public class LockAndQueue extends Object implements LockStatus
LockAndQueue has two purposes:
LockAndQueue extends
ProcedureDeque class. Blocked Procedures are added to our super Deque. Using inheritance
over composition to keep the Deque of waiting Procedures is unusual, but we do it this way
because in certain cases, there will be millions of regions. This layout uses less memory.
| Constructor and Description |
|---|
LockAndQueue(Function<Long,Procedure<?>> procedureRetriever) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLast(Procedure<?> proc) |
Stream<Procedure> |
filterWaitingQueue(Predicate<Procedure> predicate) |
Procedure<?> |
getExclusiveLockOwnerProcedure()
Get the procedure which holds the exclusive lock.
|
int |
getSharedLockCount()
Get the number of procedures which hold the shared lock.
|
boolean |
hasExclusiveLock()
Whether the exclusive lock has been held.
|
boolean |
hasLockAccess(Procedure<?> proc)
Return true if the procedure itself holds the exclusive lock, or any ancestors of the give
procedure hold the exclusive lock.
|
boolean |
isWaitingQueueEmpty() |
boolean |
releaseExclusiveLock(Procedure<?> proc) |
boolean |
releaseSharedLock() |
Procedure<?> |
removeFirst() |
String |
toString() |
boolean |
tryExclusiveLock(Procedure<?> proc) |
boolean |
trySharedLock(Procedure<?> proc) |
int |
wakeWaitingProcedures(ProcedureScheduler scheduler) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetExclusiveLockProcIdOwner, isLockedpublic boolean hasExclusiveLock()
LockStatushasExclusiveLock in interface LockStatuspublic boolean hasLockAccess(Procedure<?> proc)
LockStatushasLockAccess in interface LockStatuspublic Procedure<?> getExclusiveLockOwnerProcedure()
LockStatusgetExclusiveLockOwnerProcedure in interface LockStatuspublic int getSharedLockCount()
LockStatusgetSharedLockCount in interface LockStatuspublic boolean trySharedLock(Procedure<?> proc)
public boolean releaseSharedLock()
public boolean tryExclusiveLock(Procedure<?> proc)
public boolean releaseExclusiveLock(Procedure<?> proc)
public boolean isWaitingQueueEmpty()
public Procedure<?> removeFirst()
public void addLast(Procedure<?> proc)
public int wakeWaitingProcedures(ProcedureScheduler scheduler)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.