1 package jalview.ws2.actions.api;
5 import jalview.ws2.api.JobStatus;
6 import jalview.ws2.api.WebServiceJobHandle;
9 * The listener interface for receiving relevant job progress and state change
10 * events on the task. The listener object is registered with the task on its
11 * creation in {@link ActionI#perform} method. An event is generated when the
12 * task is started, restarted, completed, fails with an exception or its global
13 * status changes. Additional, sub-job related, events are emitted when the
14 * sub-job status, log or error log changes.
20 public interface TaskEventListener<T>
23 * Invoked when the task has been started. The {@code subJobs} parameter
24 * contains a complete list of sub-jobs for that run. Note that restartable
25 * tasks may invoke this method multiple times with different set of sub-jobs.
28 * task this event originates from
30 * list of sub-jobs for this run
32 void taskStarted(TaskI<T> source, List<? extends JobI> subJobs);
35 * Invoked when the global task status has changed.
38 * task this event originates from
42 void taskStatusChanged(TaskI<T> source, JobStatus status);
45 * Invoked when the task has completed. If the task completed with a result,
46 * that result is passed in the call argument, otherwise, a {@code null} value
50 * task this event originates from
52 * computation result or null if result not present
54 void taskCompleted(TaskI<T> source, T result);
57 * Invoked when an unhandled exception has occurred during task execution.
60 * task this event originates from
64 void taskException(TaskI<T> source, Exception e);
67 * Invoked when the task had been restarted. This event is only applicable to
68 * restartable tasks and will precede each {@link #taskStarted} after the
72 * task this event originates from
74 void taskRestarted(TaskI<T> source);
77 * Invoked when the status of a sub-job has changed.
80 * task this event originates form
82 * sub-job that has been updated
86 void subJobStatusChanged(TaskI<T> source, JobI job, JobStatus status);
89 * Invoked when a log string of the sub-job has changed.
92 * task this event originates form
94 * sub-job that has been updated
98 void subJobLogChanged(TaskI<T> source, JobI job, String log);
101 * Invoked when an error log string of the sub-job has changed.
104 * task this event originates form
106 * sub-job that has been updated
110 void subJobErrorLogChanged(TaskI<T> source, JobI job, String log);