JAL-3070 call checkDone() ASAP to avoid race condition for threads watching state...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 3 Oct 2019 15:18:39 +0000 (16:18 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 3 Oct 2019 15:18:39 +0000 (16:18 +0100)
src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java

index df3a311..fcb6e28 100644 (file)
@@ -229,8 +229,13 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker
   @Override
   public void run()
   {
+    if (checkDone())
+    {
+      return;
+    }
     if (!hasService())
     {
+      calcMan.workerComplete(this);
       return;
     }
 
@@ -244,10 +249,6 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker
     WebserviceInfo info = new WebserviceInfo("foo", "bar", false);
     try
     {
-      if (checkDone())
-      {
-        return;
-      }
       List<SequenceI> seqs = getInputSequences(
               alignViewport.getAlignment(),
               bySequence ? alignViewport.getSelectionGroup() : null);
@@ -508,7 +509,6 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker
       calcMan.workerComplete(this);
       if (ap != null)
       {
-        calcMan.workerComplete(this);
         if (guiProgress != null && progressId != -1)
         {
           guiProgress.setProgressBar("", progressId);