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
{
// 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;
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())
{
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);
}
}
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;
{
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)
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
{
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();
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();
}
});