JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / fts / service / uniprot / UniProtFTSRestClient.java
index 715b842..9501930 100644 (file)
@@ -22,6 +22,7 @@
 package jalview.fts.service.uniprot;
 
 import jalview.bin.Cache;
+import jalview.bin.Jalview;
 import jalview.fts.api.FTSData;
 import jalview.fts.api.FTSDataColumnI;
 import jalview.fts.api.FTSRestClientI;
@@ -52,41 +53,11 @@ public class UniProtFTSRestClient extends FTSRestClient
     Platform.addJ2SDirectDatabaseCall(DEFAULT_UNIPROT_DOMAIN);
   }
 
-  private static FTSRestClientI instance = null;
-
   public static FTSRestClientI getInstance()
   {
-
-    // BH 2019.05.08 need to isolate static fields in JavaScript
-
-    FTSRestClientI i = instance;
-    @SuppressWarnings("unused")
-    ThreadGroup g = null;
-    if (Platform.isJS())
-    {
-      g = Thread.currentThread().getThreadGroup();
-      /**
-       * @j2sNative i = g._jalviewUniProtFTSRestClientInstance;
-       * 
-       */
-    }
-    if (i == null)
-    {
-      i = new UniProtFTSRestClient();
-
-      if (Platform.isJS())
-      {
-        /**
-         * @j2sNative g._jalviewUniProtFTSRestClientInstance = i;
-         * 
-         */
-      }
-      else
-      {
-        instance = i;
-      }
-    }
-    return i;
+    Jalview j = Jalview.getInstance();
+    return (j.uniprotFTSRestClient == null ? j.uniprotFTSRestClient = new UniProtFTSRestClient()
+            : j.uniprotFTSRestClient);
   }
 
   public final String uniprotSearchEndpoint;