org.springframework.extensions.surf.task
Class TaskManager
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TaskManager
public TaskManager()
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.