JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / ws / jws2 / Jws2Discoverer.java
index 516a719..1f3d300 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.ws.jws2;
 
 import jalview.bin.Cache;
+import jalview.bin.Jalview;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.gui.JvSwingUtils;
@@ -70,11 +71,6 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
   private final static String JWS2HOSTURLS = "JWS2HOSTURLS";
 
   /*
-   * Singleton instance
-   */
-  private static Jws2Discoverer discoverer;
-
-  /*
    * Override for testing only
    */
   private static List<String> testUrls = null;
@@ -82,7 +78,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
   // preferred url has precedence over others
   private String preferredUrl;
 
-  private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+  protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
           this);
 
   private Vector<String> invalidServiceUrls = null;
@@ -190,7 +186,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     oldthread = Thread.currentThread();
     try
     {
-      Class foo = getClass().getClassLoader()
+      getClass().getClassLoader()
               .loadClass("compbio.ws.client.Jws2Client");
     } catch (ClassNotFoundException e)
     {
@@ -637,11 +633,10 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
    */
   public static Jws2Discoverer getDiscoverer()
   {
-    if (discoverer == null)
-    {
-      discoverer = new Jws2Discoverer();
-    }
-    return discoverer;
+    Jalview j = Jalview.getInstance();
+    return (j.j2s2discoverer == null
+            ? j.j2s2discoverer = new Jws2Discoverer()
+            : j.j2s2discoverer);
   }
 
   public boolean hasServices()