JAL-3878 Add getCalcName to AlignCalcWorkerI.
[jalview.git] / src / jalview / workers / StrucConsensusThread.java
index 98e4bd7..a53f344 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -45,30 +45,14 @@ public class StrucConsensusThread extends AlignCalcWorker
   private long nseq = -1;
 
   @Override
-  public void run()
+  public String getCalcName()
   {
-    try
-    {
-      if (calcMan.isPending(this))
-      {
-        return;
-      }
-      calcMan.notifyStart(this);
-      while (!calcMan.notifyWorking(this))
-      {
-        try
-        {
-          if (ap != null)
-          {
-            // ap.paintAlignment(false);
-          }
+    return "Struc Consensus";
+  }
 
-          Thread.sleep(200);
-        } catch (Exception ex)
-        {
-          ex.printStackTrace();
-        }
-      }
+  @Override
+  public void run()
+  {
       if (alignViewport.isClosed())
       {
         abortAndDestroy();
@@ -80,7 +64,6 @@ public class StrucConsensusThread extends AlignCalcWorker
 
       if (alignment == null || (aWidth = alignment.getWidth()) < 0)
       {
-        calcMan.workerComplete(this);
         return;
       }
       strucConsensus = alignViewport.getAlignmentStrucConsensusAnnotation();
@@ -109,7 +92,6 @@ public class StrucConsensusThread extends AlignCalcWorker
 
       if (rnaStruc == null || !rnaStruc.isValidStruc())
       {
-        calcMan.workerComplete(this);
         return;
       }
 
@@ -121,27 +103,11 @@ public class StrucConsensusThread extends AlignCalcWorker
                 alignment.getWidth(), hStrucConsensus, true, rnaStruc);
       } catch (ArrayIndexOutOfBoundsException x)
       {
-        calcMan.workerComplete(this);
         return;
       }
       alignViewport.setRnaStructureConsensusHash(hStrucConsensus);
       // TODO AlignmentAnnotation rnaStruc!!!
       updateResultAnnotation(true);
-    } catch (OutOfMemoryError error)
-    {
-      calcMan.disableWorker(this);
-
-      // consensus = null;
-      // hconsensus = null;
-      ap.raiseOOMWarning("calculating RNA structure consensus", error);
-    } finally
-    {
-      calcMan.workerComplete(this);
-      if (ap != null)
-      {
-        ap.paintAlignment(true);
-      }
-    }
 
   }