简体   繁体   English

Java RMI有什么意义?

[英]What is the point of Java RMI?

Why does Java RMI exist? 为什么Java RMI存在? Who uses it and for what? 谁使用它?用于什么用途?

My most pressing questions; 我最紧迫的问题;

  • 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? 有许多机器运行整个程序,而不是有许多机器运行每个零件,这不是更聪明吗?
  • 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 eachother 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? 这与客户端与服务器进行通信的典型Web应用程序设置有何相似之处或不同? In my mind, HTTP calls are much easier to understand. 在我看来,HTTP调用更容易理解。 Can an RMI Server require some sort of password from RMI clients? RMI服务器可以要求RMI客户端提供某种密码吗?
  • What kind of applications are typically made using Java RMI? 通常使用Java RMI制作什么样的应用程序? Any hard examples? 有困难的例子吗?

Why does Java RMI exist? 为什么Java RMI存在?

Err, because Sun built it? 错误,是因为Sun建立了它吗? The same Sun that provided Sun-RPC. 提供Sun-RPC的同一Sun。

Who uses it and for what? 谁使用它?用于什么用途?

RMI is the basis of J2EE just to name one small example. 仅举一个小例子,RMI是J2EE的基础。 However the concept of remote method calls dates further back to at least CORBA, and the concept of remote procedure calls to at least the 1970s. 但是,远程方法调用的概念至少可以追溯到CORBA,而远程过程调用的概念至少可以追溯到1970年代。 Sun provided their implementation of RPC in about 1982 and it is the basis of NFS among other things. Sun在1982年左右提供了RPC的实现,并且它是NFS的基础。

Why would you want to make calls to methods that aren't defined on your machine? 您为什么要调用未在计算机上定义的方法?

Err, if you wanted them to run on another machine? 错误,如果您希望它们在另一台计算机上运行?

Wouldn't it take much longer to execute? 执行时间不会更长吗?

Of course. 当然。

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? 有许多机器运行整个程序,而不是有许多机器运行每个零件,这不是更聪明吗?

So you've never heard of distributed computing, then? 那么,您从未听说过分布式计算吗?

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? 您必须手动为所有机器(客户端和服务器)提供接口的事实是否会抵消远程对象提供的任何好处?

No. 没有。

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 换句话说,如果拥有远程对象的好处是客户端程序员不必与服务器程序员进行交互

Did somebody say that was a benefit? 有人说这有好处吗?

then doesn't it get annoying to have manually contact each other to update the interfaces on both sides for each little change? 那么手动相互联系以为每个微小的变化更新两侧的接口会变得很烦吗?

There don't tend to be many 'little changes', if you actually design your system before implementing it. 如果您在实施系统之前进行了实际设计,那么通常不会有很多“小变化”。 But that isn't the only development model anyway. 但这并不是唯一的开发模型。 You could have a third person developing the interface. 您可能需要第三方来开发界面。 Or the same person developing both sides. 还是同一个人发展双方。 Or have the remote interface defined by a specification. 或者具有由规范定义的远程接口。 Or ... 要么 ...

How is this similar or different to a typical web app set up where a client communicates with a server? 这与客户端与服务器进行通信的典型Web应用程序设置有何相似之处或不同?

It uses RMI instead of HTTP. 它使用RMI代替HTTP。

In my mind, HTTP calls are much easier to understand. 在我看来,HTTP调用更容易理解。

You can't get much easier to understand than a remote interface, but obviously your mileage varies. 您不能比远程界面更容易理解,但是显然您的里程数有所不同。

Can an RMI Server require some sort of password from RMI clients? RMI服务器可以要求RMI客户端提供某种密码吗?

Yes, it can use mutually-authenticated SSL for example, or arbitrary authentication protocols implemented via custom socket factories. 是的,它可以使用例如相互认证的SSL或通过自定义套接字工厂实现的任意认证协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM