JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / fts / service / pdb / PDBFTSRestClient.java
index 3bb3f77..75bfd1b 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.fts.service.pdb;
 
+import jalview.bin.Jalview;
 import jalview.datamodel.SequenceI;
 import jalview.fts.api.FTSData;
 import jalview.fts.api.FTSDataColumnI;
@@ -56,41 +57,12 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
 public class PDBFTSRestClient extends FTSRestClient
 {
 
-  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._jalviewPDBFTSRestClientInstance;
-       * 
-       */
-    }
-    if (i == null)
-    {
-      i = new PDBFTSRestClient();
-
-      if (Platform.isJS())
-      {
-        /**
-         * @j2sNative g._jalviewPDBFTSRestClientInstance = i;
-         * 
-         */
-      }
-      else
-      {
-        instance = i;
-      }
-    }
-    return i;
+    Jalview j = Jalview.getInstance();
+    return (j.pdbFTSRestClient == null
+            ? j.pdbFTSRestClient = new PDBFTSRestClient()
+            : j.pdbFTSRestClient);
   }
 
   public static final String PDB_SEARCH_ENDPOINT = "https://www.ebi.ac.uk/pdbe/search/pdb/select?";