X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FColumnCounterSetWorker.java;h=a711f2bd91c869437b1131cc8f0ecb731dd8f246;hb=747167089ecf8d6afc70d417f5a20352e029bd95;hp=24cb717cf79fe1e8e9f4a807d4a466a256e36866;hpb=2f219368c3a4a3ff0ed6a34f84d005a3d85c9963;p=jalview.git diff --git a/src/jalview/workers/ColumnCounterSetWorker.java b/src/jalview/workers/ColumnCounterSetWorker.java index 24cb717..a711f2b 100644 --- a/src/jalview/workers/ColumnCounterSetWorker.java +++ b/src/jalview/workers/ColumnCounterSetWorker.java @@ -57,7 +57,7 @@ class ColumnCounterSetWorker extends AlignCalcWorker AlignmentViewPanel panel, FeatureSetCounterI counter) { super(viewport, panel); - ourAnnots = new ArrayList(); + ourAnnots = new ArrayList<>(); this.counter = counter; calcMan.registerWorker(this); } @@ -70,44 +70,22 @@ class ColumnCounterSetWorker extends AlignCalcWorker public void run() { boolean annotationAdded = false; - try + if (alignViewport.isClosed()) { - calcMan.notifyStart(this); + abortAndDestroy(); + return; + } - while (!calcMan.notifyWorking(this)) + if (alignViewport.getAlignment() != null) + { + try { - try - { - Thread.sleep(200); - } catch (InterruptedException ex) - { - ex.printStackTrace(); - } - } - if (alignViewport.isClosed()) + annotationAdded = computeAnnotations(); + } catch (IndexOutOfBoundsException x) { - abortAndDestroy(); + // probable race condition. just finish and return without any fuss. return; } - - if (alignViewport.getAlignment() != null) - { - try - { - annotationAdded = computeAnnotations(); - } catch (IndexOutOfBoundsException x) - { - // probable race condition. just finish and return without any fuss. - return; - } - } - } catch (OutOfMemoryError error) - { - ap.raiseOOMWarning("calculating feature counts", error); - calcMan.disableWorker(this); - } finally - { - calcMan.workerComplete(this); } if (ap != null) @@ -116,7 +94,7 @@ class ColumnCounterSetWorker extends AlignCalcWorker { ap.adjustAnnotationHeight(); } - ap.paintAlignment(true); + ap.paintAlignment(true, true); } }