有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java RMI的意义是什么?

为什么存在Java RMI?谁使用它?为什么

我最迫切的问题

  • 为什么要调用计算机上未定义的方法?执行不是需要更长的时间吗?我不明白这是怎么让世界变得更好的。让多台机器运行完整的程序,而不是让多台机器各运行一部分,不是更聪明吗
  • 您必须手动为所有机器(客户机和服务器)提供接口,这一事实难道不会扼杀远程对象带来的任何好处吗?换句话说,如果拥有一个远程对象的好处是客户端程序员不必与服务器程序员交互,那么手动联系对方,为每一个微小的更改更新双方的接口,不是很烦人吗
  • 这与客户端与服务器通信的典型web应用程序设置有什么相似或不同?在我看来,HTTP调用更容易理解。RMI服务器是否需要来自RMI客户端的某种密码
  • 什么样的应用程序通常使用Java RMI制作?有什么难懂的例子吗

共 (1) 个答案

  1. # 1 楼答案

    Why does Java RMI exist?

    呃,因为Sun建造了它?同一个太阳提供了Sun RPC

    Who uses it and for what?

    RMIJakarta EE(以前是J2EE)的基础,举一个小例子。然而remote method calls的概念至少可以追溯到CORBA,而remote procedure calls的概念至少可以追溯到1970年代。Sun大约在1982年提供了RPC的实现,它是NFS的基础

    Why would you want to make calls to methods that aren't defined on your machine?

    呃,如果你想让它们在另一台机器上运行

    Wouldn't it take much longer to execute?

    当然

    I don't see how this makes the world a better place. Wouldn't it just be smarter to have many machines running the complete program rather than many machines each running parts?

    那么你从没听说过distributed computing

    Doesn't the fact that you have to manually provide interfaces to all the machines (clients and servers) kill whatever benefits having remote objects provides?

    没有

    In other words, if a benefit of having a remote object is that the client programmer doesn't have to interact with the server programmer

    有人说这是个好处吗

    then doesn't it get annoying to have manually contact each other to update the interfaces on both sides for each little change?

    如果你真的在实现系统之前设计了它,那么不会有太多的“小变化”。但这并不是唯一的发展模式。你可以让第三个人开发这个界面。或者同一个人同时发展两个方面。或者让远程接口由规范定义。或者

    How is this similar or different to a typical web app set up where a client communicates with a server?

    它使用RMI而不是HTTP

    In my mind, HTTP calls are much easier to understand.

    你不可能比远程界面更容易理解,但显然你的里程数是不同的

    Can an RMI Server require some sort of password from RMI clients?

    是的,它可以使用相互认证的TLS或通过自定义套接字工厂实现的任意认证协议