标签:class java ext strong string os
ServiceRegist.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ServiceRegist extends Remote{
public user login(String userName, String password) throws RemoteException;
}
ServiceRegisterImpl.java
public class ServiceRegisterImpl extends UnicastRemoteObject implements ServiceRegist{
private UserDao userDao;
public ServiceRegisterImpl() throws RemoteException{super();}
public user login(String userName, String password) throws RemoteException{
return userDao.login(userName,password);
}
}
发布
public class RMIServer{
public static void main(String args[]){
ServiceRegist sr = new ServiceRegistImpl();
LocateRegistry.createRegistry(8888);
String url = "rmi://localhost:8888/serviceRegistry";
Naming.bind(url,sr);
System.out.println("服务调度器启动成功");
}
}
基于java工程开发RMI服务端,布布扣,bubuko.com
标签:class java ext strong string os
原文地址:http://www.cnblogs.com/rigid/p/3808971.html