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 tasksConstructor 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)
ITaskService
schedule
in interface ITaskService
task
- The task to schedulepublic void start(Long taskId)
ITaskService
start
in interface ITaskService
public void cancel(Long taskId)
ITaskService
cancel
in interface ITaskService
public Long scheduleAndStart(Task task)
ITaskService
Long taskId = taskService.schedule(task); taskService.start(taskId);
scheduleAndStart
in interface ITaskService
public void finish(Long taskId)
ITaskService
finish
in interface ITaskService
public Progression getProgression(Long taskId)
ITaskService
getProgression
in interface ITaskService
public List<Task.Message> getMessages(Long taskId)
getMessages
in interface ITaskService
Copyright © 2015. All rights reserved.