Merge branch 'JAL-3878_ws-overhaul-3' into mmw/Release_2_12_ws_merge
[jalview.git] / src / jalview / workers / AlignCalcManager2.java
index eba241a..39111ae 100644 (file)
@@ -107,23 +107,19 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
                 "Cannot submit new task if the prevoius one is still running");
       }
       Console.debug(
-              format("Worker %s queued", getWorker().getClass().getName()));
+              format("Worker %s queued", getWorker()));
       task = executor.submit(() -> {
         try
         {
-          Console.debug(format("Worker %s started",
-                  getWorker().getClass().getName()));
+          Console.debug(format("Worker %s started", getWorker()));
           getWorker().run();
-          Console.debug(format("Worker %s finished",
-                  getWorker().getClass().getName()));
+          Console.debug(format("Worker %s finished", getWorker()));
         } catch (InterruptedException e)
         {
-          Console.debug(format("Worker %s interrupted",
-                  getWorker().getClass().getName()));
+          Console.debug(format("Worker %s interrupted", getWorker()));
         } catch (Throwable th)
         {
-          Console.debug(format("Worker %s failed",
-                  getWorker().getClass().getName()), th);
+          Console.debug(format("Worker %s failed", getWorker()), th);
         } finally
         {
           if (!isRegistered())
@@ -142,8 +138,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       {
         return;
       }
-      Console.debug(format("Cancelling worker %s",
-              getWorker().getClass().getName()));
+      Console.debug(format("Cancelling worker %s", getWorker()));
       task.cancel(true);
     }
   }
@@ -174,10 +169,9 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       if (task != null && !(task.isDone() || task.isCancelled()))
       {
         throw new IllegalStateException(
-                "Cannot submit new task if the prevoius one is still running");
+                "Cannot submit new task if the previous one is still running");
       }
-      Console.debug(
-              format("Worker %s queued", getWorker().getClass().getName()));
+      Console.debug( format("Worker %s queued", getWorker()));
       final var runnable = new Runnable()
       {
         private boolean started = false;
@@ -193,26 +187,22 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
           {
             if (!started)
             {
-              Console.debug(format("Worker %s started",
-                      getWorker().getClass().getName()));
+              Console.debug(format("Worker %s started", getWorker()));
               getWorker().startUp();
               started = true;
             }
             else if (!completed)
             {
-              Console.debug(format("Polling worker %s",
-                      getWorker().getClass().getName()));
+              Console.debug(format("Polling worker %s", getWorker()));
               if (getWorker().poll())
               {
-                Console.debug(format("Worker %s finished",
-                        getWorker().getClass().getName()));
+                Console.debug(format("Worker %s finished", getWorker()));
                 completed = true;
               }
             }
           } catch (Throwable th)
           {
-            Console.debug(format("Worker %s failed",
-                    getWorker().getClass().getName()), th);
+            Console.debug(format("Worker %s failed", getWorker()), th);
             completed = true;
           }
           if (completed)
@@ -220,8 +210,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
             final var worker = getWorker();
             if (!isRegistered())
               PollableWorkerManager.super.worker = null;
-            Console.debug(format("Finalizing completed worker %s",
-                    worker.getClass().getName()));
+            Console.debug(format("Finalizing completed worker %s", worker));
             worker.done();
             // almost impossible, but the future may be null at this point
             // let it throw NPE to cancel forcefully
@@ -239,8 +228,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       {
         return;
       }
-      Console.debug(format("Cancelling worker %s",
-              getWorker().getClass().getName()));
+      Console.debug(format("Cancelling worker %s", getWorker()));
       task.cancel(false);
       executor.submit(() -> {
         final var worker = getWorker();
@@ -249,8 +237,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
         if (worker != null)
         {
           worker.cancel();
-          Console.debug(format("Finalizing cancelled worker %s",
-                  worker.getClass().getName()));
+          Console.debug(format("Finalizing cancelled worker %s", worker));
           worker.done();
         }
       });