首页 > 编程语言 > 详细

基于java工程开发RMI服务端

时间:2014-06-26 16:05:36      阅读:336      评论:0      收藏:0      [点我收藏+]

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

基于java工程开发RMI服务端

原文:http://www.cnblogs.com/rigid/p/3808971.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!