From: Mateusz Warowny Date: Mon, 6 Feb 2023 13:04:59 +0000 (+0100) Subject: Merge branch 'JAL-3878_ws-overhaul-3' into mmw/Release_2_12_ws_merge X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8307be83ae28064b8f606f6c7a77dd186485a0fa;p=jalview.git Merge branch 'JAL-3878_ws-overhaul-3' into mmw/Release_2_12_ws_merge --- 8307be83ae28064b8f606f6c7a77dd186485a0fa diff --cc src/jalview/gui/AlignFrame.java index c38f336,7011d4d..63bbb72 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@@ -4648,11 -4664,12 +4668,12 @@@ public class AlignFrame extends GAlignF webService.removeAll(); if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true)) { - Cache.log.info("Building web service menu for slivka"); + Console.info("Building web service menu for slivka"); SlivkaWSDiscoverer discoverer = SlivkaWSDiscoverer.getInstance(); - JMenu submenu = new JMenu("Slivka"); - buildWebServicesMenu(discoverer, submenu); - webService.add(submenu); + slivkaMenu.setServices(discoverer); + slivkaMenu.setInProgress(discoverer.isRunning()); + slivkaMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices()); + webService.add(slivkaMenu.getMenu()); } if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { diff --cc src/jalview/gui/SlivkaPreferences.java index 6fc14b0,ed1d5f7..5f2e106 --- a/src/jalview/gui/SlivkaPreferences.java +++ b/src/jalview/gui/SlivkaPreferences.java @@@ -38,6 -33,11 +33,11 @@@ import javax.swing.UIManager import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; -import jalview.bin.Cache; ++import jalview.bin.Console; + import jalview.util.MessageManager; + import jalview.ws2.client.api.WebServiceDiscovererI; + import jalview.ws2.client.slivka.SlivkaWSDiscoverer; + @SuppressWarnings("serial") public class SlivkaPreferences extends JPanel { @@@ -311,15 -310,18 +310,18 @@@ // Discoverer buttons action listeners private ActionListener refreshServicesAction = (ActionEvent e) -> { progressBar.setVisible(true); - Cache.log.info("Requesting service reload"); + Console.info("Requesting service reload"); - discoverer.startDiscoverer().handle((_discoverer, exception) -> { + discoverer.startDiscoverer().handle((services, exception) -> { if (exception == null) { - Cache.log.info("Reloading done"); + Console.info("Reloading done"); } - else + else if (exception instanceof CancellationException) { - Cache.log.info("Reloading cancelled"); ++ Console.info("Reloading cancelled"); + } + else { - Cache.log.error("Reloading failed", exception); + Console.error("Reloading failed", exception); } SwingUtilities.invokeLater(() -> progressBar.setVisible(false)); return null; diff --cc src/jalview/workers/AlignCalcManager2.java index eba241a,1c95179..39111ae --- a/src/jalview/workers/AlignCalcManager2.java +++ b/src/jalview/workers/AlignCalcManager2.java @@@ -106,24 -105,20 +106,20 @@@ public class AlignCalcManager2 implemen throw new IllegalStateException( "Cannot submit new task if the prevoius one is still running"); } - Cache.log.debug( - format("Worker %s queued", getWorker().getClass().getName())); + 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())); - Cache.log.debug(format("Worker %s started", getWorker())); ++ Console.debug(format("Worker %s started", getWorker())); getWorker().run(); - Console.debug(format("Worker %s finished", - getWorker().getClass().getName())); - Cache.log.debug(format("Worker %s finished", getWorker())); ++ Console.debug(format("Worker %s finished", getWorker())); } catch (InterruptedException e) { - Console.debug(format("Worker %s interrupted", - getWorker().getClass().getName())); - Cache.log.debug(format("Worker %s interrupted", getWorker())); ++ Console.debug(format("Worker %s interrupted", getWorker())); } catch (Throwable th) { - Console.debug(format("Worker %s failed", - getWorker().getClass().getName()), th); - Cache.log.debug(format("Worker %s failed", getWorker()), th); ++ Console.debug(format("Worker %s failed", getWorker()), th); } finally { if (!isRegistered()) @@@ -142,8 -137,7 +138,7 @@@ { return; } - Console.debug(format("Cancelling worker %s", - getWorker().getClass().getName())); - Cache.log.debug(format("Cancelling worker %s", getWorker())); ++ Console.debug(format("Cancelling worker %s", getWorker())); task.cancel(true); } } @@@ -174,10 -168,10 +169,9 @@@ 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())); - Cache.log.debug( - format("Worker %s queued", getWorker())); ++ Console.debug( format("Worker %s queued", getWorker())); final var runnable = new Runnable() { private boolean started = false; @@@ -193,26 -187,22 +187,22 @@@ { if (!started) { - Console.debug(format("Worker %s started", - getWorker().getClass().getName())); - Cache.log.debug(format("Worker %s started", getWorker())); ++ Console.debug(format("Worker %s started", getWorker())); getWorker().startUp(); started = true; } else if (!completed) { - Console.debug(format("Polling worker %s", - getWorker().getClass().getName())); - Cache.log.debug(format("Polling worker %s", getWorker())); ++ Console.debug(format("Polling worker %s", getWorker())); if (getWorker().poll()) { - Console.debug(format("Worker %s finished", - getWorker().getClass().getName())); - Cache.log.debug(format("Worker %s finished", getWorker())); ++ Console.debug(format("Worker %s finished", getWorker())); completed = true; } } } catch (Throwable th) { - Console.debug(format("Worker %s failed", - getWorker().getClass().getName()), th); - Cache.log.debug(format("Worker %s failed", getWorker()), th); ++ Console.debug(format("Worker %s failed", getWorker()), th); completed = true; } if (completed) @@@ -220,8 -210,7 +210,7 @@@ final var worker = getWorker(); if (!isRegistered()) PollableWorkerManager.super.worker = null; - Console.debug(format("Finalizing completed worker %s", - worker.getClass().getName())); - Cache.log.debug(format("Finalizing completed worker %s", worker)); ++ 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 +228,7 @@@ { return; } - Console.debug(format("Cancelling worker %s", - getWorker().getClass().getName())); - Cache.log.debug(format("Cancelling worker %s", getWorker())); ++ Console.debug(format("Cancelling worker %s", getWorker())); task.cancel(false); executor.submit(() -> { final var worker = getWorker(); @@@ -249,8 -237,7 +237,7 @@@ if (worker != null) { worker.cancel(); - Console.debug(format("Finalizing cancelled worker %s", - worker.getClass().getName())); - Cache.log.debug(format("Finalizing cancelled worker %s", worker)); ++ Console.debug(format("Finalizing cancelled worker %s", worker)); worker.done(); } });