org.springframework.extensions.surf.task
Class TaskManager

java.lang.Object
  extended by org.springframework.extensions.surf.task.TaskManager

public class TaskManager
extends Object

Basic implementation of a task manager for use in asynchronous processing and monitoring of tasks. Tasks are added to the task manager. When added, they are assigned a reference id so that subsequent calls to the task manager can check on the task status. A task starter thread wakes up occasionally and checks whether there are any tasks waiting to be processed. If a task is found, it is attached to a task worker thread and then executed. When the task worker thread completes, it is handed back to the task worker thread pool.

Author:
muzquiano

Constructor Summary
TaskManager()
           
 
Method Summary
 String addTask(AbstractTask task)
           
 void cancel(String taskId)
           
 HashMap<String,AbstractTask> getAllTasks()
          Returns all of the tasks
 AbstractTask getTask(String taskId)
          Returns a task that is running or has finished running
 Queue<AbstractTask> getTaskQueue()
           
 int getTaskQueueCount()
           
 int getThreadCount()
           
 int getThreadPoolSize()
           
 HashMap<String,TaskWorkerThread> getThreads()
           
 int getWakeupPeriod()
           
 void init()
           
 void remove(AbstractTask task)
           
 void remove(String taskId)
           
 void setThreadPoolSize(int threadPoolSize)
           
 void setWakeupPeriod(int wakeupPeriod)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskManager

public TaskManager()
Method Detail

init

public void init()

setThreadPoolSize

public void setThreadPoolSize(int threadPoolSize)

getThreadPoolSize

public int getThreadPoolSize()

setWakeupPeriod

public void setWakeupPeriod(int wakeupPeriod)

getWakeupPeriod

public int getWakeupPeriod()

getThreadCount

public int getThreadCount()

getTaskQueueCount

public int getTaskQueueCount()

addTask

public String addTask(AbstractTask task)

getTask

public AbstractTask getTask(String taskId)
Returns a task that is running or has finished running


getAllTasks

public HashMap<String,AbstractTask> getAllTasks()
Returns all of the tasks


remove

public void remove(String taskId)

remove

public void remove(AbstractTask task)

getTaskQueue

public Queue<AbstractTask> getTaskQueue()

getThreads

public HashMap<String,TaskWorkerThread> getThreads()

cancel

public void cancel(String taskId)


Copyright © 2009 SpringSource, Inc. All Rights Reserved.