JAL - 3690 AlignCalc rebuilt - FutureTask-based manager
[jalview.git] / src / jalview / workers / InformationThread.java
index 85cd92f..c8084b9 100644 (file)
@@ -48,73 +48,34 @@ public class InformationThread extends AlignCalcWorker
     {
       return;
     }
-    if (calcMan.isPending(this))
+    if (alignViewport.isClosed())
     {
+      abortAndDestroy();
       return;
     }
-    calcMan.notifyStart(this);
-    // long started = System.currentTimeMillis();
 
-    try
+    AlignmentI alignment = alignViewport.getAlignment();
+    int aWidth = alignment == null ? -1 : alignment.getWidth();
+    if (aWidth < 0)
     {
-      if (calcMan.isPending(this))
-      {
-        // another instance of this is waiting to run
-        calcMan.workerComplete(this);
-        return;
-      }
-      while (!calcMan.notifyWorking(this))
-      {
-        // another thread in progress, wait my turn
-        try
-        {
-          if (ap != null)
-          {
-            ap.paintAlignment(false, false);
-          }
-          Thread.sleep(200);
-        } catch (Exception ex)
-        {
-          ex.printStackTrace();
-        }
-      }
-      if (alignViewport.isClosed())
-      {
-        abortAndDestroy();
-        return;
-      }
-
-      AlignmentI alignment = alignViewport.getAlignment();
-      int aWidth = alignment == null ? -1 : alignment.getWidth();
-      if (aWidth < 0)
-      {
-        calcMan.workerComplete(this);
-        return;
-      }
+      return;
+    }
 
-      /*
-       * compute information profiles for any HMM consensus sequences
-       * for the alignment or sub-groups
-       */
-      computeProfiles(alignment);
+    /*
+     * compute information profiles for any HMM consensus sequences
+     * for the alignment or sub-groups
+     */
+    computeProfiles(alignment);
 
-      /*
-       * construct the corresponding annotations
-       */
-      updateAnnotation();
+    /*
+     * construct the corresponding annotations
+     */
+    updateAnnotation();
 
-      if (ap != null)
-      {
-        ap.adjustAnnotationHeight();
-        ap.paintAlignment(true, true);
-      }
-    } catch (OutOfMemoryError error)
-    {
-      calcMan.disableWorker(this);
-      ap.raiseOOMWarning("calculating information", error);
-    } finally
+    if (ap != null)
     {
-      calcMan.workerComplete(this);
+      ap.adjustAnnotationHeight();
+      ap.paintAlignment(true, true);
     }
   }