@InterfaceAudience.Private public class ProcedureEvent<T> extends Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private T |
object |
private boolean |
ready |
private ProcedureDeque |
suspendedProcedures |
Constructor and Description |
---|
ProcedureEvent(T object) |
Modifier and Type | Method and Description |
---|---|
ProcedureDeque |
getSuspendedProcedures()
Access to suspendedProcedures is 'synchronized' on this object, but it's fine to return it here
for tests.
|
boolean |
isReady() |
void |
suspend()
Mark the event as not ready.
|
boolean |
suspendIfNotReady(Procedure proc)
Returns true if event is not ready and adds procedure to suspended queue, else returns false.
|
String |
toString() |
void |
wake(AbstractProcedureScheduler procedureScheduler)
Wakes up the suspended procedures by pushing them back into scheduler queues and sets the event
as ready.
|
static void |
wakeEvents(AbstractProcedureScheduler scheduler,
ProcedureEvent... events)
Wakes up all the given events and puts the procedures waiting on them back into
ProcedureScheduler queues.
|
boolean |
wakeIfSuspended(AbstractProcedureScheduler procedureScheduler,
Procedure<?> proc)
Wakes up the suspended procedures only if the given
proc is waiting on this event. |
(package private) void |
wakeInternal(AbstractProcedureScheduler procedureScheduler)
Only to be used by ProcedureScheduler implementations.
|
private static final org.slf4j.Logger LOG
private boolean ready
private ProcedureDeque suspendedProcedures
public ProcedureEvent(T object)
public boolean isReady()
public boolean suspendIfNotReady(Procedure proc)
public void suspend()
public void wake(AbstractProcedureScheduler procedureScheduler)
wakeInternal(AbstractProcedureScheduler)
for why this is not
synchronized.public boolean wakeIfSuspended(AbstractProcedureScheduler procedureScheduler, Procedure<?> proc)
proc
is waiting on this event.
Mainly used by region assignment to reject stale OpenRegionProcedure/CloseRegionProcedure. Use
with caution as it will cause performance issue if there are lots of procedures waiting on the
event.public static void wakeEvents(AbstractProcedureScheduler scheduler, ProcedureEvent... events)
void wakeInternal(AbstractProcedureScheduler procedureScheduler)
wake(AbstractProcedureScheduler)
above uses the
same code path as used when waking up multiple events. Access should remain package-private.public ProcedureDeque getSuspendedProcedures()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.