JAL-3878 Code reformatting.
[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   {
24     if (getJobs().size() == 0)
25       return false;
26     for (WSJob job : getJobs())
27     {
28       if (!job.getStatus().isDone())
29         return false;
30     }
31     return true;
32   }
33
34   /*
35    * Called by the executor when the worker transitions to the done state
36    * either normally or exceptionally.
37    */
38   void done();
39 }