X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws2%2FSeqAnnotationServiceCalcWorker.java;h=ae03dfba371848c22e46e0a4bdd131bf4d6a6cb7;hb=6a6fb5010c2cd06b14a1e055eabaeb4848e65d2d;hp=132408b1aa4becc95017af2a2bb52b393e6428ce;hpb=b13d4ee2f7839be680d23ce157aff4e204377a8f;p=jalview.git diff --git a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java index 132408b..ae03dfb 100644 --- a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java +++ b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java @@ -227,15 +227,15 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker private int min_valid_seqs; @Override - public void run() + public void run() throws Exception { - if (checkDone()) + if (alignViewport.isClosed()) { + abortAndDestroy(); return; } if (!hasService()) { - calcMan.workerComplete(this); return; } @@ -257,7 +257,6 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker { jalview.bin.Cache.log.debug( "Sequences for analysis service were null or not valid"); - calcMan.workerComplete(this); return; } @@ -329,41 +328,13 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker Cache.log.debug("Status now " + running.getState()); } - if (calcMan.isPending(this) && isInteractiveUpdate()) - { - Cache.log.debug("Analysis service job is stale. aborting."); - // job has become stale. - if (!finished) { - finished = true; - // cancel this job and yield to the new job - try - { - if (cancellable - && ((CancellableI) annotService).cancel(running)) - { - System.err.println("Cancelled job: " + rslt); - } - else - { - System.err.println("FAILED TO CANCEL job: " + rslt); - } - - } catch (Exception x) - { - - } - } - rslt = running.getJobHandle(); - return; - } - // pull any stats - some services need to flush log output before // results are available Cache.log.debug("Updating progress log for annotation service."); try { - annotService.updateJobProgress(running); + annotService.updateJobProgress(running); } catch (Throwable thr) { Cache.log.debug("Ignoring exception during progress update.", @@ -523,10 +494,10 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker System.err .println("Blacklisting worker due to unexpected exception:"); x.printStackTrace(); + throw new Exception(x); } finally { - calcMan.workerComplete(this); if (ap != null) { if (guiProgress != null && progressId != -1) @@ -889,43 +860,6 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker } } - /** - * notify manager that we have started, and wait for a free calculation slot - * - * @return true if slot is obtained and work still valid, false if another - * thread has done our work for us. - */ - protected boolean checkDone() - { - calcMan.notifyStart(this); - ap.paintAlignment(false, false); - while (!calcMan.notifyWorking(this)) - { - if (calcMan.isWorking(this)) - { - return true; - } - try - { - if (ap != null) - { - ap.paintAlignment(false, false); - } - - Thread.sleep(200); - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - if (alignViewport.isClosed()) - { - abortAndDestroy(); - return true; - } - return false; - } - protected void updateOurAnnots(List ourAnnot) { List our = ourAnnots;