da6e5400113cf560b68b901b0bbc6e6eea13eb6b
[jalview.git] / src / jalview / ws2 / WebServiceWorkerI.java
1 package jalview.ws2;
2
3 import java.io.IOException;
4 import java.util.List;
5
6 import javax.print.attribute.standard.JobState;
7
8 import jalview.util.MathUtils;
9
10 public interface WebServiceWorkerI
11 {
12   long getUID();
13
14   List<WSJob> getJobs();
15
16   void startJobs() throws IOException;
17
18   boolean pollJobs() throws IOException;
19
20   WebServiceI getWebService();
21
22   default boolean isDone() {
23     if (getJobs().size() == 0)
24       return false;
25     for (WSJob job : getJobs()) {
26       if (!job.getStatus().isDone())
27         return false;
28     }
29     return true;
30   }
31
32   /*
33    * Called by the executor when the worker transitions to the done state
34    * either normally or exceptionally.
35    */
36   void done();
37 }