JAL-961 JAL-976 kill any existing AACon job if a new AACon worker is started due...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Jun 2012 10:47:25 +0000 (11:47 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Jun 2012 14:02:05 +0000 (15:02 +0100)
src/jalview/ws/jws2/JabawsAlignCalcWorker.java

index eb898b3..df61495 100644 (file)
@@ -82,7 +82,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
   public void updateParameters(final WsParamSetI newpreset,
           final List<Argument> newarguments)
   {
-    if (calcMan.isWorking(this))
+    if (false) // || calcMan.isWorking(this))
     {
       new Thread(new Runnable()
       {
@@ -187,6 +187,28 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
         {
           finished = true;
         }
+        if (calcMan.isPending(this) && this instanceof AAConsClient)
+        {
+          finished = true;
+          // cancel this job and yield to the new job
+          try
+          {
+            if (aaservice.cancelJob(rslt))
+            {
+              System.err.println("Cancelled AACon job: " + rslt);
+            }
+            else
+            {
+              System.err.println("FAILED TO CANCELL AACon job: " + rslt);
+            }
+
+          } catch (Exception x)
+          {
+
+          }
+
+          return;
+        }
         long cpos;
         ChunkHolder stats;
         do