1 16 package org.mortbay.stop; 17 18 import java.io.OutputStream ; 19 import java.net.InetAddress ; 20 import java.net.Socket ; 21 22 23 24 25 39 40 public class Main 41 { 42 private boolean _debug = System.getProperty("DEBUG",null)!=null; 43 private String _config = System.getProperty("START","org/mortbay/start/start.config"); 44 private int _port = Integer.getInteger("STOP.PORT",8079).intValue(); 45 private String _key = System.getProperty("STOP.KEY","mortbay"); 46 47 public static void main(String [] args) 48 { 49 new Main().stop(); 50 } 51 52 void stop() 53 { 54 try 55 { 56 if (_port<=0) 57 System.err.println("START.PORT system property must be specified"); 58 if (_key==null) 59 { 60 _key=""; 61 System.err.println("Using empty key"); 62 } 63 64 Socket s=new Socket (InetAddress.getByName("127.0.0.1"),_port); 65 OutputStream out=s.getOutputStream(); 66 out.write((_key+"\r\nstop\r\n").getBytes()); 67 out.flush(); 68 s.shutdownOutput(); 69 s.close(); 70 } 71 catch (Exception e) 72 { 73 e.printStackTrace(); 74 } 75 } 76 } 77 | Popular Tags |