public class TasksManager extends java.lang.Object implements TasksManagerInterface
TasksManagerInterface
,
TaskInterface
,
Task
Constructor and Description |
---|
TasksManager()
Construct a TaskManager
|
Modifier and Type | Method and Description |
---|---|
void |
addTask(TaskInterface task)
add a task to the TaskManager
|
void |
cleanTasks(long maxTaskInactivityDuration)
Destroy all the old tasks from its list of tasks
|
void |
clearAllTasks()
Remove all the tasks from the TaskManager
|
TaskInterface |
getTaskById(int taskId)
Return the task corresponding to the id given
in parameter
|
int |
getTaskId(TaskInterface task)
Return the id of the task given as parameter
|
void |
removeTask(TaskInterface task)
Remove a task from the TaskManager
|
public TasksManager()
tasksCleanerTimerInMillis
- the time in milliseconds for the frequence
of cleaning of the TaskManager's tasksmaxTaskInactivityDurationInMillis
- the time in milliseconds from which
a task is considered as too oldpublic void addTask(TaskInterface task)
addTask
in interface TasksManagerInterface
task
- the task to add to the the TaskInterface=public int getTaskId(TaskInterface task)
getTaskId
in interface TasksManagerInterface
task
- the task of which the id will be givenpublic TaskInterface getTaskById(int taskId)
getTaskById
in interface TasksManagerInterface
taskId
- the id of which the task will be givenpublic void removeTask(TaskInterface task)
removeTask
in interface TasksManagerInterface
task
- the TaskInterface to remove from the
TaskManagerpublic void clearAllTasks()
clearAllTasks
in interface TasksManagerInterface
public void cleanTasks(long maxTaskInactivityDuration)
cleanTasks
in interface TasksManagerInterface