Support for --kill mode in the webidor.jar
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 11 Oct 2009 19:32:48 +0200
changeset 1234529cb22ff7d
parent 122 e0ecef0c421b
child 124 90371f3eb106
Support for --kill mode in the webidor.jar
webidor/pom.xml
webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java
     1.1 --- a/webidor/pom.xml	Sun Oct 11 19:19:09 2009 +0200
     1.2 +++ b/webidor/pom.xml	Sun Oct 11 19:32:48 2009 +0200
     1.3 @@ -9,7 +9,7 @@
     1.4    <groupId>org.apidesign</groupId>
     1.5    <artifactId>webidor</artifactId>
     1.6    <packaging>jar</packaging>
     1.7 -  <version>1.5</version>
     1.8 +  <version>1.6</version>
     1.9    <name>webidor server</name>
    1.10    <url>http://maven.apache.org</url>
    1.11    <repositories>
     2.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java	Sun Oct 11 19:19:09 2009 +0200
     2.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java	Sun Oct 11 19:32:48 2009 +0200
     2.3 @@ -120,7 +120,7 @@
     2.4      // start the server
     2.5      //
     2.6  
     2.7 -    public static void main(String[] args) throws IOException {
     2.8 +    public static void main(String[] args) throws IOException, InterruptedException {
     2.9          int port = 9222;
    2.10          try {
    2.11              port = Integer.parseInt(args[0]);
    2.12 @@ -131,6 +131,14 @@
    2.13          System.out.println(
    2.14              "Quoridor started at port " + port + "\n" + "Hit enter to stop it..."
    2.15          );
    2.16 +        if (args.length < 2 || !args[args.length - 1].equals("--kill")) {
    2.17 +            System.out.println("Hit enter to stop it...");
    2.18 +            System.in.read();
    2.19 +        } else {
    2.20 +            synchronized (Quoridor.class) {
    2.21 +                Quoridor.class.wait();
    2.22 +            }
    2.23 +        }
    2.24          System.in.read();
    2.25          s.stop(0);
    2.26          System.exit(0);