public class TaskQueue
extends java.lang.Object
Constructor and Description |
---|
TaskQueue() |
Modifier and Type | Method and Description |
---|---|
boolean |
changeRun(TaskoRun runIn)
- while there're workers in the queue,
they will be executed as within the same run
to get stored all the logs together
- otherwise we would lose the logs,
because worker execution get managed automatically by the queue
|
int |
getExecutingWorkerCount()
Returns the number of currently executing workers
This should never be more than the thread pool's
maximum size
|
QueueDriver |
getQueueDriver()
Get the current QueueDriver
|
TaskoRun |
getQueueRun()
returns queue run
|
int |
getQueueSize()
Returns the number of workers pending
|
void |
run()
Create workers for all current candidates or set the current job run to FINISHED in
case there is no new candidates and workers are all done.
|
void |
setQueueDriver(QueueDriver driver)
Store the QueueDriver instance used when run() is called
|
void |
waitForEmptyQueue()
Waits indefinitely until the queue has emptied of all workers
|
void |
workerDone()
Callback all workers should call when
finished with their work item
|
void |
workerStarting()
Callback all workers should call when starting
to process work
|
public void setQueueDriver(QueueDriver driver)
driver
- to be used as the current QueueDriverpublic QueueDriver getQueueDriver()
public void workerStarting()
public void workerDone()
public int getExecutingWorkerCount()
public int getQueueSize()
public void run()
public void waitForEmptyQueue() throws java.lang.InterruptedException
java.lang.InterruptedException
- the wait is interruptedpublic boolean changeRun(TaskoRun runIn)
runIn
- associated runpublic TaskoRun getQueueRun()