Class SimpleProcedureScheduler
java.lang.Object
org.apache.iotdb.confignode.procedure.scheduler.AbstractProcedureScheduler
org.apache.iotdb.confignode.procedure.scheduler.SimpleProcedureScheduler
- All Implemented Interfaces:
ProcedureScheduler
Simple scheduler for procedures
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWaiting(Procedure proc) voidclear()Clear current state of scheduler such that it is equivalent to newly created scheduler.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.booleanReturns true if there are procedures available to process.intReturns the number of elements in this queue.voidvoidThe procedure can't run at the moment.
-
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
public void 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. -
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
public boolean 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
public int 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.
-
addWaiting
-
releaseWaiting
public void releaseWaiting()
-