JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / rest / RestHandler.java
index a37882f..b897eaa 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.rest;
 
+import jalview.bin.Jalview;
 import jalview.httpserver.AbstractRequestHandler;
 
 import java.io.IOException;
@@ -39,11 +40,6 @@ public class RestHandler extends AbstractRequestHandler
   private static final String MY_NAME = "Rest";
 
   /**
-   * Singleton instance of this class
-   */
-  private static RestHandler instance = null;
-
-  /**
    * Returns the singleton instance of this class
    * 
    * @return
@@ -53,12 +49,10 @@ public class RestHandler extends AbstractRequestHandler
   {
     synchronized (RestHandler.class)
     {
-      if (instance == null)
-      {
-        instance = new RestHandler();
-      }
+      Jalview j = Jalview.getInstance();
+      return (j.restHandler == null ? j.restHandler = new RestHandler()
+              : j.restHandler);
     }
-    return instance;
   }
 
   /**