rmiserverstarter.java.svn-base
来自「rmi server web service for a stock track」· SVN-BASE 代码 · 共 62 行
SVN-BASE
62 行
package ase.assignment.sts.rmi.server;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.Naming;
import ase.assignment.sts.utils.STSConstants;
public class RMIServerStarter {
public static void main(String args[]) {
System.out.println(System.getProperty("java.security.policy"));
try {
// set the security manager
// if (System.getSecurityManager() == null) {
// System.setSecurityManager(new SecurityManager());
// }
// HandlerFactory factory = new HandlerFactoryRMIServerImpl();
// CustomerHandler customer = factory.getCustomerHandler();
// CustomerHandler customerStub =
// (CustomerHandler) UnicastRemoteObject.exportObject(customer, 0);
// Registry registry = LocateRegistry.getRegistry();
// System.out.println("RMI Server before binding");
// registry.rebind(STSConstants.RMI_NAME_CUSTOMER, customerStub);
/* System.setSecurityManager(new RMISecurityManager());
Registry registry = LocateRegistry.getRegistry();
registry.rebind(STSConstants.RMI_NAME_CUSTOMER,
new CustomerHandlerRMIServerImpl());
registry.rebind(STSConstants.RMI_NAME_PORTFOLIO,
new PortfolioHandlerRMIServerImpl());
registry.rebind(STSConstants.RMI_NAME_STOCK,
new StockHandlerRMIServerImpl());
*/
Naming.rebind(STSConstants.RMI_NAME_CUSTOMER,
new CustomerHandlerRMIServerImpl());
Naming.rebind(STSConstants.RMI_NAME_PORTFOLIO,
new PortfolioHandlerRMIServerImpl());
Naming.rebind(STSConstants.RMI_NAME_STOCK,
new StockHandlerRMIServerImpl());
System.out.println("RMI Server running.....");
}
catch (RemoteException re) {
System.out.println("Remote exception: " + re.toString());
}
catch(Exception e){
System.out.println("Remote Server launching error: " + e.toString());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?