1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sun Aug 30 14:44:49 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sun Aug 30 14:56:32 2009 +0200
1.3 @@ -44,6 +44,7 @@
1.4 import java.util.List;
1.5 import java.util.Map;
1.6 import java.util.Properties;
1.7 +import java.util.concurrent.Callable;
1.8 import javax.ws.rs.DefaultValue;
1.9 import javax.ws.rs.FormParam;
1.10 import javax.ws.rs.GET;
1.11 @@ -201,17 +202,30 @@
1.12 //
1.13
1.14 public static void main(String[] args) throws Exception {
1.15 - HttpServer api = Quoridor.start(9998);
1.16 + Callable<Void> r = startServers();
1.17 +
1.18 + System.in.read();
1.19 + r.call();
1.20 + System.exit(0);
1.21 + }
1.22 +
1.23 + static Callable<Void> startServers() throws Exception {
1.24 + final HttpServer api = Quoridor.start(9998);
1.25 Client client = new Client();
1.26 base = client.resource(new URI("http://localhost:9998/api/"));
1.27
1.28 - HttpServer s = start(9997);
1.29 + final HttpServer s = start(9997);
1.30 System.out.println(
1.31 "Quoridor started at port 9997\n" + "Hit enter to stop it..."
1.32 );
1.33 - System.in.read();
1.34 - s.stop(0);
1.35 - System.exit(0);
1.36 +
1.37 + return new Callable<Void>() {
1.38 + public Void call() throws Exception {
1.39 + s.stop(0);
1.40 + api.stop(0);
1.41 + return null;
1.42 + }
1.43 + };
1.44 }
1.45
1.46 static HttpServer start(int port) throws IOException {