JAL-3253 jalview.bin.Instance handles all singleton instances -
[jalview.git] / src / jalview / ws / jws2 / jabaws2 / Jws2Instance.java
index 60edfe6..5ea646f 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -20,6 +20,7 @@
  */
 package jalview.ws.jws2.jabaws2;
 
+import jalview.bin.Instance;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.util.MessageManager;
@@ -159,7 +160,8 @@ public class Jws2Instance
     }
     throw new Error(MessageManager.formatMessage(
             "error.implementation_error_runner_config_not_available",
-            new String[] { serviceType, service.getClass().toString() }));
+            new String[]
+            { serviceType, service.getClass().toString() }));
   }
 
   @Override
@@ -169,13 +171,11 @@ public class Jws2Instance
     {
       try
       {
-        Closeable svc = (Closeable) service;
-        service = null;
-        svc.close();
-      } catch (Exception e)
+        ((Closeable) service).close();
+      } catch (Throwable t)
       {
+        // ignore
       }
-      ;
     }
     super.finalize();
   }
@@ -187,7 +187,7 @@ public class Jws2Instance
       try
       {
         paramStore = new JabaParamStore(this,
-                (Desktop.instance != null ? Desktop.getUserParameterStore()
+                (Instance.getDesktop() != null ? Desktop.getUserParameterStore()
                         : null));
       } catch (Exception ex)
       {
@@ -204,7 +204,8 @@ public class Jws2Instance
     // this is only valid for Jaba 1.0 - this formula might have to change!
     return hosturl
             + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
-                    : "/") + serviceType;
+                    : "/")
+            + serviceType;
   }
 
   private boolean hasParams = false, lookedForParams = false;