import java.util.List;
-import jalview.viewmodel.AlignmentViewport;
import jalview.ws2.api.JobStatus;
-import jalview.ws2.api.WebServiceJobHandle;
/**
* {@code TaskI} objects represent running services. Tasks are created by
public interface TaskI<T>
{
/**
+ * Get the universal identifier of this task.
+ *
+ * @return identifier
+ */
+ long getUid();
+
+ /**
* Get the current status of the task. The resultant status should be a
* combination of individual sub-job statuses.
*
*/
List<? extends JobI> getSubJobs();
+ void addTaskEventListener(TaskEventListener<T> listener);
+
+ void removeTaskEventListener(TaskEventListener<T> listener);
+
/**
* Get the last result of the task or {@code null} if not present. Note that
* the result is subject to change for restartable tasks.
*/
T getResult();
+ public void init() throws Exception;
+
+ public boolean poll() throws Exception;
+
+ public void complete() throws Exception;
+
/**
* Cancel the task, stop all sub-jobs running on a server and stop all threads
* managing this task.