1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Fri Sep 04 23:02:23 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Mon Sep 07 17:43:43 2009 +0200
1.3 @@ -193,22 +193,33 @@
1.4 //
1.5
1.6 public static void main(String[] args) throws Exception {
1.7 - Callable<Void> r = startServers();
1.8 + int port = 9998;
1.9 + if (args.length > 1) {
1.10 + port = Integer.parseInt(args[0]);
1.11 + }
1.12
1.13 - System.in.read();
1.14 +
1.15 + Callable<Void> r = startServers(port);
1.16 +
1.17 + if (args.length > 2 && args[1].equals("--kill")) {
1.18 + System.out.println("Hit enter to stop it...");
1.19 + System.in.read();
1.20 + } else {
1.21 + synchronized (UI.class) {
1.22 + UI.class.wait();
1.23 + }
1.24 + }
1.25 r.call();
1.26 System.exit(0);
1.27 }
1.28
1.29 - static Callable<Void> startServers() throws Exception {
1.30 - final HttpServer api = Quoridor.start(9998);
1.31 + static Callable<Void> startServers(int port) throws Exception {
1.32 + final HttpServer api = Quoridor.start(port + 1);
1.33 Client client = new Client();
1.34 - base = client.resource(new URI("http://localhost:9998/api/"));
1.35 + base = client.resource(new URI("http://localhost:" + (port + 1) + "/api/"));
1.36
1.37 - final HttpServer s = start(9997);
1.38 - System.out.println(
1.39 - "Quoridor started at port 9997\n" + "Hit enter to stop it..."
1.40 - );
1.41 + final HttpServer s = start(port);
1.42 + System.out.println("Quoridor started at port " + port);
1.43
1.44 return new Callable<Void>() {
1.45 public Void call() throws Exception {