From ad0636fb9c1228acda52c28d2530c6456574480f Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 3 Oct 2019 16:18:39 +0100 Subject: [PATCH] JAL-3070 call checkDone() ASAP to avoid race condition for threads watching state of the calculation manager (e.g. in tests) --- src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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); -- 1.7.10.2