From 37113a71428eeee5a934693f860eef4902c41c19 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Tue, 15 Oct 2013 11:35:36 -0700 Subject: [PATCH] Updated Client server discovery lifecycle (markdown) --- Client-server-discovery-lifecycle.md | 32 ++++------------------------ 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/Client-server-discovery-lifecycle.md b/Client-server-discovery-lifecycle.md index 66a9ca3..2decb17 100644 --- a/Client-server-discovery-lifecycle.md +++ b/Client-server-discovery-lifecycle.md @@ -96,8 +96,8 @@ We create a new interface for the sbt launcher, called `xsbt.ServerMain`: package xsbti; public interface ServerMain { - public ServerPort[] start(AppConfiguration configuration, ShutdownService shutdown); - public boolean isAlive(ServerPort[] ports); + public java.net.URI[] start(AppConfiguration configuration); + public boolean isAlive(java.net.URI[] listenPorts); } ``` @@ -108,30 +108,6 @@ The interface has two methods. One responsible for starting the Server, and ano 3. Checking to see if the old server is alive. If so, report these ports to the client (TODO - how?) 4. If the old server was not alive, start up a new server (fork + detach?). Write the new server bindings to the lock file. -Port bindings come in triples of `Address`, `Port` and `Protocol` mappings: +Port bindings come in java.net.URI, which includes an address, a protocol and a port. The server will actually also write down the PID (process ID) of the server (assuming it can obtain the pid). This enables clients to "kill rogue sbt server" directly. -```java -package xsbti; - -interface ServerPort { - public java.net.INetAddress address(); // Can be IPv6 or IPv4 - public int port(); - public String protocol(); // A string-based definition of protocol, i.e. http, https - // or even custom, like sbt -} -``` - -Clients should be able to be notified of all open ServerPort bindings created by a server. - - -The shutdown service, passed to a server is designed so that the server itself can determine when it needs to go away. For example, sbt may want to shutdown its own server when there are no remaining connected clients, or after a timeout. The shutdown service has a single method, which tells the sbt-launcher to obtain the lock file and remove any active port bindings from the current server in the lock file: - -```java -package xsbti; - -interface ShutdownService { - void shutdownServer(ServerPort[] activePorts); -} -``` - -The server should not actually release ports until the ShutdownService call returns, this way ensuring that new services that may be starting up don't grab the same port and have our shutdown blow away their configuration. \ No newline at end of file +Clients should be able to be notified of all open ServerPort bindings created by a server. \ No newline at end of file