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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear current state of scheduler such that it is equivalent to newly created scheduler.voidcompletionCleanup(Procedure proc) The procedure in execution completed.protected Proceduredequeue()Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.protected voidAdd the procedure to the queue.getLockResource(LockedResourceType resourceType, String resourceName) getLocks()List lock queues.booleanReturns true if there are procedures available to process.intReturns the number of elements in this queue.toString()voidThe 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:AbstractProcedureSchedulerAdd the procedure to the queue. NOTE: this method is called with the sched lock held.- Specified by:
enqueuein 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:AbstractProcedureSchedulerFetch one Procedure from the queue NOTE: this method is called with the sched lock held.- Specified by:
dequeuein classAbstractProcedureScheduler- Returns:
- the Procedure to execute, or null if nothing is available.
-
clear
Description copied from interface:ProcedureSchedulerClear current state of scheduler such that it is equivalent to newly created scheduler. Used for testing failure and recovery. To emulate server crash/restart,ProcedureExecutorresets its own state and calls clear() on scheduler. -
yield
Description copied from interface:ProcedureSchedulerThe 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:AbstractProcedureSchedulerReturns true if there are procedures available to process. NOTE: this method is called with the sched lock held.- Specified by:
queueHasRunnablesin classAbstractProcedureScheduler- Returns:
- true if there are procedures available to process, otherwise false.
-
queueSize
Description copied from class:AbstractProcedureSchedulerReturns the number of elements in this queue. NOTE: this method is called with the sched lock held.- Specified by:
queueSizein classAbstractProcedureScheduler- Returns:
- the number of elements in this queue.
-
completionCleanup
Description copied from interface:ProcedureSchedulerThe procedure in execution completed. This can be implemented to perform cleanups.- Parameters:
proc- the Procedure that completed the execution.
-
getLocks
Description copied from interface:ProcedureSchedulerList lock queues.- Returns:
- the locks
-
getLockResource
- Returns:
LockedResourcefor resource of specified type & name. null if resource is not locked.
-
toString
- Overrides:
toStringin classAbstractProcedureScheduler
-