?? rmiregistry.java
字號:
/******************************************************************************* * Copyright (C) 2002, 2003 * ingenieurbuero fuer innovative informationstechnik (iiit) * Dipl.-Ing. Joerg Beckmann, Dortmund, Germany * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * version $Id: RMIRegistry.java,v 1.7 2003/04/13 21:14:56 joerg Exp $ ******************************************************************************/package de.iiit.access.server.plugins.server;import de.iiit.access.common.api.*;import de.iiit.access.common.rmi.*;import de.iiit.access.server.*;import de.iiit.access.server.api.*;import de.iiit.access.server.plugins.server.*;import de.iiit.xmlconfig.*;import org.apache.log4j.Logger;import java.rmi.*;import java.rmi.server.*;import java.rmi.registry.*;/** Implements a RMI server for requesting the AccessServer * @version $Revision: 1.7 $ $Date: 2003/04/13 21:14:56 $ */public class RMIRegistry implements ThreadPluginIf{ /** CVS Version Tag */ private static final String vcid = "$Id: RMIRegistry.java,v 1.7 2003/04/13 21:14:56 joerg Exp $"; private Logger logger = Logger.getLogger(this.getClass()); private static final String PORT = "Port"; private Registry registry = null; private RMIServer server = null; private int port; /** Creates a new instance of RmiServer * @throws RemoteException when anything goes wrong */ public RMIRegistry() throws RemoteException { logger.info("RMIRegistry intantiated."); } /** Initializes the server * @param config the configuration of the server. Currently the only parameter is <CODE>Port</CODE> * which defines the port number to listen on for connections. Default is <CODE>1234</CODE> */ public void initialize(Configuration config) { port = config.getIntAttribute(PORT, RMIServerIf.DEFAULT_RMI_PORT); logger.info("RMIRegistry configured on port <" + port + ">."); } /** This method is called by the AccessServer when the background threads should * stop because of a shutdown of the AccessServer itself. * */ public void shutdown() { try { registry.unbind("RMIServer"); if (server != null) UnicastRemoteObject.unexportObject(server, true); } catch (RemoteException re) { logger.fatal("Error while shutting down", re); } catch (NotBoundException nbe) { logger.fatal("Error while shutting down", nbe); } } /** This method is called by the AccessServer when the background thread should * start. It is called after the method initialize() is called for all plug-ins. * */ public void start() { logger.info("Starting RMI registry on <" + port + ">."); try { server = new RMIServer(); registry = LocateRegistry.createRegistry(port); registry.rebind("RMIServer", server); logger.info("RMI: RMIServer successfully registered."); } catch (RemoteException re) { logger.fatal("Error while starting RMI registry", re); } } }/** * $Log: RMIRegistry.java,v $ * Revision 1.7 2003/04/13 21:14:56 joerg * Copyright statements changed to GPL * * Revision 1.6 2003/04/13 20:49:09 joerg * Package structure modified * * Revision 1.5 2003/04/13 20:28:01 joerg * Package structure modified * * Revision 1.4 2003/04/13 20:16:42 joerg * Package structure modified * * Revision 1.3 2003/04/07 20:08:49 joerg * Improved JavaDoc. * * Revision 1.2 2003/03/30 20:44:16 joerg * Ongoing development * * Revision 1.1 2003/03/27 20:39:46 joerg * New class RMIServer * */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -