@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.
| 构造器和说明 |
|---|
LockAndQueue(Function<Long,Procedure<?>> procedureRetriever) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 LockStatuspublic boolean hasLockAccess(Procedure<?> proc)
LockStatushasLockAccess 在接口中 LockStatuspublic Procedure<?> getExclusiveLockOwnerProcedure()
LockStatusgetExclusiveLockOwnerProcedure 在接口中 LockStatuspublic int getSharedLockCount()
LockStatusgetSharedLockCount 在接口中 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–2019 The Apache Software Foundation. All rights reserved.