@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, wait
getExclusiveLockProcIdOwner, isLocked
public boolean hasExclusiveLock()
LockStatus
hasExclusiveLock
in interface LockStatus
public boolean hasLockAccess(Procedure<?> proc)
LockStatus
hasLockAccess
in interface LockStatus
public Procedure<?> getExclusiveLockOwnerProcedure()
LockStatus
getExclusiveLockOwnerProcedure
in interface LockStatus
public int getSharedLockCount()
LockStatus
getSharedLockCount
in interface LockStatus
public 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 Cloudera. All rights reserved.