org.gvsig.remoteclient.taskplanning
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:
ITaskPlanner

Method Summary
 ITaskPlanner getTaskPlanner()
          Returns the task planner currently defined by this queue.
 java.util.Vector getTasks()
          Returns the set of tasks in a Vector (thread-safe).
 boolean isEmpty()
          Returns true if the Queue has no (more) jobs to do.
 void pause()
          Causes the execution of this queue to be paused.
 IRunnableTask put(IRunnableTask task)
          Adds a new task to the queue.
 void resume()
          Causes the execution of this queue to be resumed.
 void setTaskPlanner(ITaskPlanner planner)
          Sets the TaskPlanner that will decide which of the tasks in the queue will be executed next.
 IRunnableTask take()
          Returns the next task by calling the task planner's nextTask() method.
 

Method Detail

put

IRunnableTask put(IRunnableTask task)
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

void setTaskPlanner(ITaskPlanner planner)
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

java.util.Vector getTasks()
Returns the set of tasks in a Vector (thread-safe).

Returns:
Vector containing the tasks in this queue.


Copyright © 2004-2013 gvSIG. All Rights Reserved.