zoukankan      html  css  js  c++  java
  • 基于java工程开发RMI服务端

    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("服务调度器启动成功");

      }

    }

  • 相关阅读:
    COGS 859. 数列
    9.7noip模拟试题
    hash练习
    9.6noip模拟试题
    9.5noip模拟试题
    poj 2117 Electricity
    洛谷P1993 小 K 的农场(查分约束)
    9.2noip模拟试题
    洛谷 P1273 有线电视网(dp)
    面试题收集
  • 原文地址:https://www.cnblogs.com/rigid/p/3808971.html
Copyright © 2011-2022 走看看