com.ds.fw.utils
Class FwScheduler

java.lang.Object
  |
  +--com.ds.fw.utils.FwScheduler

public class FwScheduler
extends java.lang.Object

This class manages a number of tasks. Each task is an instance of class, inheritor of the FwTask class. There could be one and only instance of this scheduler, which is referenced by the getInstance() method. A task is added to the scheduler by addTask() method which has two parameters, first is a name of the task and second - a task object. The name is the task's key and it is used in the managing process. An added task could be removed from the scheduler (removeTask()) or its object could be get (getTask()), by its name. The scheduler's work flow could be managed by methods similar to these of a task. The scheduler could be started (start() - starts all added tasks), suspended (suspend() - suspends all tasks), resumed (resume() - resumes all tasks) or stopped (stop() - stops all tasks and clears the scheduler's tasks list).


Method Summary
 void addTask(java.lang.String taskName, com.ds.fw.utils.FwTask taskObject)
          This method adds a new Task to the task table.
 void addTasks(com.ds.fw.co.schedulebroker.FwCoScheduleBroker coScheduleBroker)
           
static com.ds.fw.utils.FwScheduler getInstance()
          This method returns a reference to the only instance of the Scheduler class
 com.ds.fw.utils.FwTask getTask(java.lang.String taskToGet)
          This method gets a Task from the table
 java.util.Vector getTasks()
          This method gets all tasks from the table and returns a vector with them
static void main(java.lang.String[] args)
          The main method first registers all tasks with the Scheduler,then runs them
 void removeTask(java.lang.String taskToBeRemoved)
          This method removes a Task from the table and destroys its thread
 void resume()
          This method is called to resume the stopped scheduler.
 void start()
          This method is called to start the scheduler.
 void stop()
          This method is called to remove all tasks
 void suspend()
          This method is called to stop the scheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static com.ds.fw.utils.FwScheduler getInstance()
This method returns a reference to the only instance of the Scheduler class


main

public static void main(java.lang.String[] args)
The main method first registers all tasks with the Scheduler,then runs them


start

public void start()
This method is called to start the scheduler. It starts all tasks.


suspend

public void suspend()
This method is called to stop the scheduler. It pauses all threads.


resume

public void resume()
This method is called to resume the stopped scheduler. It resumes all threads.


stop

public void stop()
This method is called to remove all tasks


addTask

public void addTask(java.lang.String taskName,
                    com.ds.fw.utils.FwTask taskObject)
This method adds a new Task to the task table.


getTask

public com.ds.fw.utils.FwTask getTask(java.lang.String taskToGet)
                               throws java.lang.Exception
This method gets a Task from the table

java.lang.Exception

getTasks

public java.util.Vector getTasks()
This method gets all tasks from the table and returns a vector with them


removeTask

public void removeTask(java.lang.String taskToBeRemoved)
This method removes a Task from the table and destroys its thread


addTasks

public void addTasks(com.ds.fw.co.schedulebroker.FwCoScheduleBroker coScheduleBroker)