/** Destroy all the old tasks from its list of tasks */ public void cleanTasks(long maxTaskInactivityDuration) { for (TaskInterface task : lstTask) { if (task != null) { if (((task.getResults().getStatus() == EnumStatus.DONE) || (task.getResults().getStatus() == EnumStatus.ERROR)) && (task.inactiveSince() > maxTaskInactivityDuration)) { RequestHandler.printLog("task deleted : " + task.getPath()); task.getClient().removeTask(task); } } } }
/** * Remove a task from the TaskManager * * @param task the TaskInterface to remove from the TaskManager */ @Override public void removeTask(TaskInterface task) { task.kill(); this.lstTask.set(getTaskId(task), null); }
/** Remove all the tasks from the TaskManager */ @Override public void clearAllTasks() { for (TaskInterface task : lstTask) if (task != null) task.kill(); lstTask.clear(); }
@Override public int compareTo(TaskInterface o) { return this.getPriority() - o.getPriority(); }