JAL-3878 log full worker repr in AlignCalcManager
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 25 Apr 2022 16:34:02 +0000 (18:34 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 25 Apr 2022 16:34:02 +0000 (18:34 +0200)
src/jalview/workers/AlignCalcManager2.java

index 8d4796d..1c95179 100644 (file)
@@ -110,19 +110,15 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       task = executor.submit(() -> {
         try
         {
-          Cache.log.debug(format("Worker %s started",
-                  getWorker().getClass().getName()));
+          Cache.log.debug(format("Worker %s started", getWorker()));
           getWorker().run();
-          Cache.log.debug(format("Worker %s finished",
-                  getWorker().getClass().getName()));
+          Cache.log.debug(format("Worker %s finished", getWorker()));
         } catch (InterruptedException e)
         {
-          Cache.log.debug(format("Worker %s interrupted",
-                  getWorker().getClass().getName()));
+          Cache.log.debug(format("Worker %s interrupted", getWorker()));
         } catch (Throwable th)
         {
-          Cache.log.debug(format("Worker %s failed",
-                  getWorker().getClass().getName()), th);
+          Cache.log.debug(format("Worker %s failed", getWorker()), th);
         } finally
         {
           if (!isRegistered())
@@ -141,8 +137,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       {
         return;
       }
-      Cache.log.debug(format("Cancelling worker %s",
-              getWorker().getClass().getName()));
+      Cache.log.debug(format("Cancelling worker %s", getWorker()));
       task.cancel(true);
     }
   }
@@ -176,7 +171,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
                 "Cannot submit new task if the prevoius one is still running");
       }
       Cache.log.debug(
-              format("Worker %s queued", getWorker().getClass().getName()));
+              format("Worker %s queued", getWorker()));
       final var runnable = new Runnable()
       {
         private boolean started = false;
@@ -192,26 +187,22 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
           {
             if (!started)
             {
-              Cache.log.debug(format("Worker %s started",
-                      getWorker().getClass().getName()));
+              Cache.log.debug(format("Worker %s started", getWorker()));
               getWorker().startUp();
               started = true;
             }
             else if (!completed)
             {
-              Cache.log.debug(format("Polling worker %s",
-                      getWorker().getClass().getName()));
+              Cache.log.debug(format("Polling worker %s", getWorker()));
               if (getWorker().poll())
               {
-                Cache.log.debug(format("Worker %s finished",
-                        getWorker().getClass().getName()));
+                Cache.log.debug(format("Worker %s finished", getWorker()));
                 completed = true;
               }
             }
           } catch (Throwable th)
           {
-            Cache.log.debug(format("Worker %s failed",
-                    getWorker().getClass().getName()), th);
+            Cache.log.debug(format("Worker %s failed", getWorker()), th);
             completed = true;
           }
           if (completed)
@@ -219,8 +210,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
             final var worker = getWorker();
             if (!isRegistered())
               PollableWorkerManager.super.worker = null;
-            Cache.log.debug(format("Finalizing completed worker %s",
-                    worker.getClass().getName()));
+            Cache.log.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
@@ -238,8 +228,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
       {
         return;
       }
-      Cache.log.debug(format("Cancelling worker %s",
-              getWorker().getClass().getName()));
+      Cache.log.debug(format("Cancelling worker %s", getWorker()));
       task.cancel(false);
       executor.submit(() -> {
         final var worker = getWorker();
@@ -248,8 +237,7 @@ public class AlignCalcManager2 implements AlignCalcManagerI2
         if (worker != null)
         {
           worker.cancel();
-          Cache.log.debug(format("Finalizing cancelled worker %s",
-                  worker.getClass().getName()));
+          Cache.log.debug(format("Finalizing cancelled worker %s", worker));
           worker.done();
         }
       });