码迷,mamicode.com
首页 > 编程语言 > 详细

基于java工程开发RMI服务端

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

标签: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

基于java工程开发RMI服务端

标签:class   java   ext   strong   string   os   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!