1 package org.getahead.dwrdemo.cli; 2 3 import org.mortbay.jetty.Server; 4 5 8 public final class JettyShutdown implements Runnable  9 { 10 13 private final Server server; 14 15 18 public JettyShutdown(Server server) 19 { 20 this.server = server; 21 } 22 23 public void run() 24 { 25 try 26 { 27 server.stop(); 28 } 29 catch (Exception ex) 30 { 31 ex.printStackTrace(); 32 } 33 } 34 35 39 public static void addShutdownHook(Server server) 40 { 41 Runtime.getRuntime().addShutdownHook(new Thread (new JettyShutdown(server))); 42 } 43 } | Popular Tags |