X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fhttpserver%2FHttpServer.java;h=f2daf2b6d30d74f9f18216c04209edade7e552ed;hb=4dd96dd41cb37178a6dc0298ce08c8bfcdfab715;hp=8797f331bfb7a10b6f7dd379ff9d6842ba28b08e;hpb=ad1f4306281b0894fa42394b9a68da834cf14af6;p=jalview.git diff --git a/src/jalview/httpserver/HttpServer.java b/src/jalview/httpserver/HttpServer.java index 8797f33..f2daf2b 100644 --- a/src/jalview/httpserver/HttpServer.java +++ b/src/jalview/httpserver/HttpServer.java @@ -20,7 +20,8 @@ */ package jalview.httpserver; -import jalview.bin.Instance; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; import jalview.rest.RestHandler; import java.net.BindException; @@ -50,8 +51,33 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; * @author gmcarstairs * @see http://eclipse.org/jetty/documentation/current/embedding-jetty.html */ -public class HttpServer +public class HttpServer implements ApplicationSingletonI { + /* + * 'context root' - actually just prefixed to the path for each handler for + * now - see registerHandler + */ + private static final String JALVIEW_PATH = "jalview"; + + /* + * The Http server + */ + private Server server; + + /* + * Registered handlers for context paths + */ + private HandlerCollection contextHandlers; + + /* + * Lookup of ContextHandler by its wrapped handler + */ + Map myHandlers = new HashMap<>(); + + /* + * The context root for the server + */ + private URI contextRoot; /** * Returns the singleton instance of this class. @@ -63,9 +89,7 @@ public class HttpServer { synchronized (HttpServer.class) { - Instance j = Instance.getInstance(); - return (j.httpServer == null ? j.httpServer = new HttpServer() - : j.httpServer); + return (HttpServer) ApplicationSingletonProvider.getInstance(HttpServer.class); } } @@ -87,32 +111,6 @@ public class HttpServer registerHandler(RestHandler.getInstance()); } - /* - * 'context root' - actually just prefixed to the path for each handler for - * now - see registerHandler - */ - private static final String JALVIEW_PATH = "jalview"; - - /* - * The Http server - */ - private Server server; - - /* - * Registered handlers for context paths - */ - private HandlerCollection contextHandlers; - - /* - * Lookup of ContextHandler by its wrapped handler - */ - Map myHandlers = new HashMap<>(); - - /* - * The context root for the server - */ - private URI contextRoot; - /** * Start the http server *