接口 ProcedureScheduler
-
public interface ProcedureSchedulerKeep track of the runnable procedures
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidaddBack(Procedure proc)Inserts the specified element at the end of this queue.voidaddBack(Procedure proc, boolean notify)Inserts the specified element at the end of this queue.voidaddFront(Procedure proc)Inserts the specified element at the front of this queue.voidaddFront(Procedure proc, boolean notify)Inserts the specified element at the front of this queue.voidclear()Clear current state of scheduler such that it is equivalent to newly created scheduler.booleanhasRunnables()Procedurepoll()Fetch one Procedure from the queueProcedurepoll(long timeout, java.util.concurrent.TimeUnit unit)Fetch one Procedure from the queuevoidsignalAll()In 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 schedulervoidyield(Procedure proc)The procedure can't run at the moment. add it back to the queue, giving priority to someone else.
-
-
-
方法详细资料
-
start
void start()
Start the scheduler
-
stop
void stop()
Stop the scheduler
-
signalAll
void signalAll()
In case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.
-
addFront
void addFront(Procedure proc)
Inserts the specified element at the front of this queue.- 参数:
proc- the Procedure to add
-
addFront
void addFront(Procedure proc, boolean notify)
Inserts the specified element at the front of this queue.- 参数:
proc- the Procedure to addnotify- whether need to notify worker
-
addBack
void addBack(Procedure proc)
Inserts the specified element at the end of this queue.- 参数:
proc- the Procedure to add
-
addBack
void addBack(Procedure proc, boolean notify)
Inserts the specified element at the end of this queue.- 参数:
proc- the Procedure to addnotify- whether need to notify worker
-
yield
void yield(Procedure proc)
The procedure can't run at the moment. add it back to the queue, giving priority to someone else.- 参数:
proc- the Procedure to add back to the list
-
hasRunnables
boolean hasRunnables()
- 返回:
- true if there are procedures available to process, otherwise false.
-
poll
Procedure poll()
Fetch one Procedure from the queue- 返回:
- the Procedure to execute, or null if nothing present.
-
poll
Procedure poll(long timeout, java.util.concurrent.TimeUnit unit)
Fetch one Procedure from the queue- 参数:
timeout- how long to wait before giving up, in units of unitunit- a TimeUnit determining how to interpret the timeout parameter- 返回:
- the Procedure to execute, or null if nothing present.
-
size
int size()
Returns the number of elements in this queue.- 返回:
- the number of elements in this queue.
-
clear
void clear()
Clear current state of scheduler such that it is equivalent to newly created scheduler. Used for testing failure and recovery.
-
-