public class TaskService extends Object implements ITaskService
Should be registered as SESSION scoped bean to prevent memory leaks with unfinished tasks.
TODO automatic cleanup of tasks| Constructor and Description |
|---|
TaskService(Executor executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(Long taskId)
Cancel the task with given taskId.
|
void |
finish(Long taskId)
Cleanup the task with the given taskId and remove it from the task service.
|
List<Task.Message> |
getMessages(Long taskId) |
Progression |
getProgression(Long taskId)
Get the current progression of a task.
|
Long |
schedule(Task task)
Schedules the task, but doesn't start!
|
Long |
scheduleAndStart(Task task)
Schedule and start a task.
|
void |
start(Long taskId)
Start the task with given taskId
|
public TaskService(Executor executor)
public Long schedule(Task task)
ITaskServiceschedule in interface ITaskServicetask - The task to schedulepublic void start(Long taskId)
ITaskServicestart in interface ITaskServicepublic void cancel(Long taskId)
ITaskServicecancel in interface ITaskServicepublic Long scheduleAndStart(Task task)
ITaskServiceLong taskId = taskService.schedule(task); taskService.start(taskId);
scheduleAndStart in interface ITaskServicepublic void finish(Long taskId)
ITaskServicefinish in interface ITaskServicepublic Progression getProgression(Long taskId)
ITaskServicegetProgression in interface ITaskServicepublic List<Task.Message> getMessages(Long taskId)
getMessages in interface ITaskServiceCopyright © 2015. All rights reserved.