1 4 5 package org.jfox.ioc; 6 7 import java.net.URLConnection ; 8 import java.net.URL ; 9 10 13 14 public class Stop { 15 16 private static String protocol = "http"; 17 private static String port = "8080"; 18 private static String host = "localhost"; 19 private static String servletUrl = "/console/servlet/org.jfox.ioc.management.http.InvokeServlet?componentname=org.jfox.ioc.common.ShutdownHook&operHashCode=-1250380938475170858"; 20 21 public static void main(String [] args) throws Exception { 22 System.out.println("usage: stop [server]"); 23 if(args == null || args.length == 0) { 24 System.out.println("default stop jfoxco ioc kernel locahost!"); 25 } 26 else { 27 host = args[0]; 28 System.out.println("stop jfoxco ioc kernel " + host + "!"); 29 } 30 31 String _url = protocol + "://" + host + ":" + port + "/" + servletUrl; 32 33 URL url = new URL (_url); 34 35 URLConnection conn = url.openConnection(); 36 conn.setDoInput(true); 37 try { 38 conn.connect(); 39 40 } 41 catch(Exception e) { 42 System.out.println("cannot connect server " + host + "."); 43 System.exit(0); 44 } 45 try { 46 47 conn.getContent(); 48 } 49 catch(Exception e) { 50 } 52 53 System.out.println("stop " + host + " successfully."); 54 55 } 56 } 57 | Popular Tags |