*/
package jalview.httpserver;
-import jalview.bin.Jalview;
import jalview.rest.RestHandler;
import java.net.BindException;
*/
private static final String JALVIEW_PATH = "jalview";
- /**
- * Returns the singleton instance of this class.
- *
- * @return
- * @throws BindException
+ /*
+ * Singleton instance of this server
*/
- public static HttpServer getInstance() throws BindException
- {
- synchronized (HttpServer.class)
- {
- Jalview j = Jalview.getInstance();
- return (j.httpServer == null ? j.httpServer = new HttpServer()
- : j.httpServer);
- }
- }
+ private static HttpServer instance;
/*
* The Http server
/*
* Lookup of ContextHandler by its wrapped handler
*/
- Map<Handler, ContextHandler> myHandlers = new HashMap<>();
+ Map<Handler, ContextHandler> myHandlers = new HashMap<Handler, ContextHandler>();
/*
* The context root for the server
private URI contextRoot;
/**
+ * Returns the singleton instance of this class.
+ *
+ * @return
+ * @throws BindException
+ */
+ public static HttpServer getInstance() throws BindException
+ {
+ synchronized (HttpServer.class)
+ {
+ if (instance == null)
+ {
+ instance = new HttpServer();
+ }
+ return instance;
+ }
+ }
+
+ /**
* Private constructor to enforce use of singleton
*
* @throws BindException