public class DynamicScheduler<I,O,T extends Task<I,O>>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
Constructor and Description |
---|
DynamicScheduler(java.util.List<T> tasks) |
Modifier and Type | Method and Description |
---|---|
void |
cleanInputQueue()
Clean the input queue
|
java.util.List<T> |
getTasks()
Get the list of tasks
|
boolean |
hasError()
Check if has errors or not
|
boolean |
hasOutput()
Check if has a new output
|
void |
pause()
Pause the task
|
void |
pauseNow()
Pause the task immediately
|
void |
start()
Start scheduling
|
void |
stop()
Stop submission Send stop signal to the queue
based on the number of tasks
|
void |
submit(I input)
Submit the input
|
void |
submitAll(java.util.Collection<I> inputs)
Submit a collection of inputs
|
void |
submitAll(I[] inputs)
Submit an array of inputs
|
O |
waitForOutput()
Blocked and wait for outputs Invoke as
while(hasOutput()) { waitForOutput(); }
|
public DynamicScheduler(java.util.List<T> tasks)
public java.util.List<T> getTasks()
public void submit(I input)
input
- the inputpublic void submitAll(java.util.Collection<I> inputs)
inputs
- a collection of inputspublic void submitAll(I[] inputs)
inputs
- an aray of inputspublic void start()
public void pause()
public void pauseNow()
public void cleanInputQueue()
public void stop()
public O waitForOutput()
public boolean hasOutput()
public boolean hasError()