Interface IQueue
- All Known Implementing Classes:
RetrieveQueue
public interface IQueue
You should write your own concrete Queue implementation to hold the tasks in
a specific kind of queue.
Following the contract, you should also write a task planner that does what
you desire. Task planners are a concrete class of the ITaskPlanner that would
plannify which is the next, the previous,.. task to be done. However, if
you don't want to write anything special, just guess a simple FIFO queue
- Author:
- jaume dominguez faus - jaume.dominguez@iver.es
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the task planner currently defined by this queue.getTasks()Returns the set of tasks in a Vector (thread-safe).booleanisEmpty()Returns true if the Queue has no (more) jobs to do.voidpause()Causes the execution of this queue to be paused.put(IRunnableTask task) Adds a new task to the queue.voidresume()Causes the execution of this queue to be resumed.voidsetTaskPlanner(ITaskPlanner planner) Sets the TaskPlanner that will decide which of the tasks in the queue will be executed next.take()Returns the next task by calling the task planner's nextTask() method.
-
Method Details
-
put
Adds a new task to the queue. The place where the new task will be put its left to the concrete implementation of this interface.- Parameters:
IRunnableTask- task
-
take
IRunnableTask take()Returns the next task by calling the task planner's nextTask() method.- Returns:
- IRunnableTask with the next task to be executed.
-
isEmpty
boolean isEmpty()Returns true if the Queue has no (more) jobs to do.- Returns:
-
getTaskPlanner
ITaskPlanner getTaskPlanner()Returns the task planner currently defined by this queue.- Returns:
- ITaskPlanner
-
setTaskPlanner
Sets the TaskPlanner that will decide which of the tasks in the queue will be executed next. A null value should represent a FIFO planner.- Parameters:
planner-
-
pause
void pause()Causes the execution of this queue to be paused. The task currently in execution finishes and after it the planner will not issue more tasks until resume() is invoked. -
resume
void resume()Causes the execution of this queue to be resumed. The execution will continue with the next task issued by the planner. It has no effect if the queue was not paused yet. -
getTasks
Vector getTasks()Returns the set of tasks in a Vector (thread-safe).- Returns:
- Vector containing the tasks in this queue.
-