Class SimpleProcedureScheduler
java.lang.Object
org.apache.hadoop.hbase.procedure2.AbstractProcedureScheduler
org.apache.hadoop.hbase.procedure2.SimpleProcedureScheduler
- All Implemented Interfaces:
ProcedureScheduler
Simple scheduler for procedures
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear current state of scheduler such that it is equivalent to newly created scheduler.void
completionCleanup
(Procedure proc) The procedure in execution completed.protected Procedure
dequeue()
Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.protected void
Add the procedure to the queue.getLockResource
(LockedResourceType resourceType, String resourceName) getLocks()
List lock queues.boolean
Returns true if there are procedures available to process.int
Returns the number of elements in this queue.toString()
void
The procedure can't run at the moment.Methods inherited from class org.apache.hadoop.hbase.procedure2.AbstractProcedureScheduler
addBack, addBack, addFront, addFront, addFront, getNullPollCalls, getPollCalls, hasRunnables, poll, poll, poll, push, schedLock, schedUnlock, signalAll, size, start, stop, waitProcedure, wakeEvents, wakePollIfNeeded, wakeProcedure, wakeWaitingProcedures
-
Field Details
-
runnables
-
-
Constructor Details
-
SimpleProcedureScheduler
public SimpleProcedureScheduler()
-
-
Method Details
-
enqueue
Description copied from class:AbstractProcedureScheduler
Add the procedure to the queue. NOTE: this method is called with the sched lock held.- Specified by:
enqueue
in classAbstractProcedureScheduler
- Parameters:
procedure
- the Procedure to addaddFront
- true if the item should be added to the front of the queue
-
dequeue
Description copied from class:AbstractProcedureScheduler
Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.- Specified by:
dequeue
in classAbstractProcedureScheduler
- Returns:
- the Procedure to execute, or null if nothing is available.
-
clear
Description copied from interface:ProcedureScheduler
Clear current state of scheduler such that it is equivalent to newly created scheduler. Used for testing failure and recovery. To emulate server crash/restart,ProcedureExecutor
resets its own state and calls clear() on scheduler. -
yield
Description copied from interface:ProcedureScheduler
The procedure can't run at the moment. add it back to the queue, giving priority to someone else.- Parameters:
proc
- the Procedure to add back to the list
-
queueHasRunnables
Description copied from class:AbstractProcedureScheduler
Returns true if there are procedures available to process. NOTE: this method is called with the sched lock held.- Specified by:
queueHasRunnables
in classAbstractProcedureScheduler
- Returns:
- true if there are procedures available to process, otherwise false.
-
queueSize
Description copied from class:AbstractProcedureScheduler
Returns the number of elements in this queue. NOTE: this method is called with the sched lock held.- Specified by:
queueSize
in classAbstractProcedureScheduler
- Returns:
- the number of elements in this queue.
-
completionCleanup
Description copied from interface:ProcedureScheduler
The procedure in execution completed. This can be implemented to perform cleanups.- Parameters:
proc
- the Procedure that completed the execution.
-
getLocks
Description copied from interface:ProcedureScheduler
List lock queues.- Returns:
- the locks
-
getLockResource
- Returns:
LockedResource
for resource of specified type & name. null if resource is not locked.
-
toString
- Overrides:
toString
in classAbstractProcedureScheduler
-