From: Jim Procter Date: Thu, 3 Oct 2019 15:18:39 +0000 (+0100) Subject: JAL-3070 call checkDone() ASAP to avoid race condition for threads watching state... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ad0636fb9c1228acda52c28d2530c6456574480f;p=jalview.git JAL-3070 call checkDone() ASAP to avoid race condition for threads watching state of the calculation manager (e.g. in tests) --- diff --git a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java index df3a311..fcb6e28 100644 --- a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java +++ b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java @@ -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 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);