1 package jalview.ws2.actions.api;
5 import jalview.ws2.api.JobStatus;
8 * {@code TaskI} objects represent running services. Tasks are created by
9 * concrete implementations of {@link ActionI} and provide a view of the state
10 * of the underlying job(s).
17 public interface TaskI<T>
20 * Get the universal identifier of this task.
27 * Get the current status of the task. The resultant status should be a
28 * combination of individual sub-job statuses.
30 * @return global status of
32 JobStatus getStatus();
35 * Get the current list of sub-jobs of that task.
39 List<? extends JobI> getSubJobs();
41 void addTaskEventListener(TaskEventListener<T> listener);
43 void removeTaskEventListener(TaskEventListener<T> listener);
46 * Get the last result of the task or {@code null} if not present. Note that
47 * the result is subject to change for restartable tasks.
49 * @return last task result
53 public void init() throws Exception;
55 public boolean poll() throws Exception;
57 public void complete() throws Exception;
60 * Cancel the task, stop all sub-jobs running on a server and stop all threads