?? shutdown.java
字號:
/******************************************************************************* * Copyright (C) 2002, 2003 * ingenieurbuero fuer innovative informationstechnik (iiit) * Dipl.-Ing. Joerg Beckmann, Dortmund, Germany * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * or look at http://www.gnu.org/copleft/lesser.html. * * version $Id: ShutDown.java,v 1.6 2003/04/13 21:13:38 joerg Exp $ ******************************************************************************/package de.iiit.access.client;import de.iiit.access.common.api.*;import de.iiit.access.common.rmi.*;import java.rmi.*;import java.rmi.registry.*;/** The ShutDown program can be used to shut down a AccessServer running on the * local host. Because there is no user authentication or anytihng else to assure * that only authorized user can use, it can not be used to shut down remote servers. * @version $Revision: 1.6 $ $Date: 2003/04/13 21:13:38 $ */public class ShutDown{ /** CVS Version Tag */ private static final String vcid = "$Id: ShutDown.java,v 1.6 2003/04/13 21:13:38 joerg Exp $"; private static final int DEFAULT_PORT = 54322; private static int port = DEFAULT_PORT; /** Creates a new instance of Client */ public ShutDown() { } private static void processCmdLine(String[] args) { String portString = null; for (int i = 0; i < args.length; i++) { String a = args[i]; if (a.equals("-p")) { if (++i < args.length) portString = args[i]; } else if (a.startsWith("-p")) { portString = a.substring(2); } }// if (portString == null)// {// log.fatal("Usage: ... -f [/location/of/startup.xml]");// // System.exit(1);// } if (portString != null) { int port = Integer.parseInt(portString); } } /** This is the main method of the ShutDown command. It processes the command line, * connects to the server on localhost and sends a shutdown command to the server. * @param args the command line arguments */ public static void main(String[] args) { processCmdLine(args); long t = System.currentTimeMillis(); try { t = System.currentTimeMillis(); Registry registry = LocateRegistry.getRegistry("localhost", port); t = System.currentTimeMillis() - t; System.out.println("Got remote registry within " + t + " ms"); t = System.currentTimeMillis(); RMIServerIf sessionManager = (RMIServerIf) registry.lookup("RMIServer"); t = System.currentTimeMillis() - t; System.out.println("Got remote object within " + t + " ms"); // t = System.currentTimeMillis();// System.out.println(session.getHelloWorld());// t = System.currentTimeMillis() - t;//// System.out.println("Remote request done within " + t + " ms"); t = System.currentTimeMillis(); sessionManager.serverShutdown(); t = System.currentTimeMillis() - t; System.out.println("Remote shutdown request done within " + t + " ms"); } catch (Exception e) { t = System.currentTimeMillis() - t; e.printStackTrace(); System.out.println("Request aborted after " + t + " ms"); } } }/** * $Log: ShutDown.java,v $ * Revision 1.6 2003/04/13 21:13:38 joerg * Copyright statements changed to LGPL * * Revision 1.5 2003/04/13 21:09:56 joerg * Package structure modified * * Revision 1.4 2003/04/13 20:16:41 joerg * Package structure modified * * Revision 1.3 2003/04/07 20:08:49 joerg * Improved JavaDoc. * * Revision 1.2 2003/04/06 20:45:00 joerg * GPL statement and some comments included. * */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -