Class AbstractProcedureScheduler
java.lang.Object
org.apache.iotdb.confignode.procedure.scheduler.AbstractProcedureScheduler
- All Implemented Interfaces:
ProcedureScheduler
- Direct Known Subclasses:
SimpleProcedureScheduler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified element at the end of this queue.voidInserts the specified element at the end of this queue.voidInserts the specified element at the front of this queue.voidInserts the specified element at the front of this queue.protected abstract Proceduredequeue()Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.protected abstract voidAdd the procedure to the queue.booleanpoll()Fetch one Procedure from the queuepoll(long nanos) Fetch one Procedure from the queueprotected voidprotected abstract booleanReturns true if there are procedures available to process.protected abstract intReturns the number of elements in this queue.protected voidprotected voidvoidIn case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.intsize()Returns the number of elements in this queue.voidstart()Start the schedulervoidstop()Stop the schedulerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iotdb.confignode.procedure.scheduler.ProcedureScheduler
clear, yield
-
Constructor Details
-
AbstractProcedureScheduler
public AbstractProcedureScheduler()
-
-
Method Details
-
start
public void start()Description copied from interface:ProcedureSchedulerStart the scheduler- Specified by:
startin interfaceProcedureScheduler
-
stop
public void stop()Description copied from interface:ProcedureSchedulerStop the scheduler- Specified by:
stopin interfaceProcedureScheduler
-
signalAll
public void signalAll()Description copied from interface:ProcedureSchedulerIn case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.- Specified by:
signalAllin interfaceProcedureScheduler
-
enqueue
Add the procedure to the queue. NOTE: this method is called with the sched lock held.- Parameters:
procedure- the Procedure to addaddFront- true if the item should be added to the front of the queue
-
addFront
Description copied from interface:ProcedureSchedulerInserts the specified element at the front of this queue.- Specified by:
addFrontin interfaceProcedureScheduler- Parameters:
procedure- the Procedure to add
-
addFront
Description copied from interface:ProcedureSchedulerInserts the specified element at the front of this queue.- Specified by:
addFrontin interfaceProcedureScheduler- Parameters:
procedure- the Procedure to addnotify- whether need to notify worker
-
addBack
Description copied from interface:ProcedureSchedulerInserts the specified element at the end of this queue.- Specified by:
addBackin interfaceProcedureScheduler- Parameters:
procedure- the Procedure to add
-
addBack
Description copied from interface:ProcedureSchedulerInserts the specified element at the end of this queue.- Specified by:
addBackin interfaceProcedureScheduler- Parameters:
procedure- the Procedure to addnotify- whether need to notify worker
-
push
-
dequeue
Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.- Returns:
- the Procedure to execute, or null if nothing is available.
-
poll
Description copied from interface:ProcedureSchedulerFetch one Procedure from the queue- Specified by:
pollin interfaceProcedureScheduler- Returns:
- the Procedure to execute, or null if nothing present.
-
poll
Description copied from interface:ProcedureSchedulerFetch one Procedure from the queue- Specified by:
pollin interfaceProcedureScheduler- Parameters:
timeout- how long to wait before giving up, in units of unitunit- a TimeUnit determining how to interpret the timeout parameter- Returns:
- the Procedure to execute, or null if nothing present.
-
poll
-
queueSize
protected abstract int queueSize()Returns the number of elements in this queue. NOTE: this method is called with the sched lock held.- Returns:
- the number of elements in this queue.
-
queueHasRunnables
protected abstract boolean queueHasRunnables()Returns true if there are procedures available to process. NOTE: this method is called with the sched lock held.- Returns:
- true if there are procedures available to process, otherwise false.
-
size
public int size()Description copied from interface:ProcedureSchedulerReturns the number of elements in this queue.- Specified by:
sizein interfaceProcedureScheduler- Returns:
- the number of elements in this queue.
-
hasRunnables
public boolean hasRunnables()- Specified by:
hasRunnablesin interfaceProcedureScheduler- Returns:
- true if there are procedures available to process, otherwise false.
-
schedLock
protected void schedLock() -
schedUnlock
protected void schedUnlock()
-