Java RMI 和 RPC 有什么区别?

发布于 2024-08-30 13:18:15 字数 60 浏览 4 评论 0原文

Java RMI 和 RPC 之间的实际区别是什么?

我在一些地方读到 RMI 使用对象?

What is the actual difference between Java RMI and RPC?

I have read in some places that RMI uses Objects?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

何时共饮酒 2024-09-06 13:18:15

RPC是基于C的,因此它具有结构化编程语义,另一方面,RMI是基于Java的技术,并且是面向对象的。

使用 RPC,您可以调用导出到服务器中的远程函数,在 RMI 中,您可以引用远程对象并调用它们的方法,还可以传递和返回更多远程对象引用,这些引用可以分布在许多 JVM 实例中,因此它更强大。

当需要开发比纯客户端-服务器架构更复杂的东西时,RMI 就会脱颖而出。在网络上分布对象非常容易,使所有客户端都可以进行通信,而无需显式建立单独的连接。

RPC is C based, and as such it has structured programming semantics, on the other side, RMI is a Java based technology and it's object oriented.

With RPC you can just call remote functions exported into a server, in RMI you can have references to remote objects and invoke their methods, and also pass and return more remote object references that can be distributed among many JVM instances, so it's much more powerful.

RMI stands out when the need to develop something more complex than a pure client-server architecture arises. It's very easy to spread out objects over a network enabling all the clients to communicate without having to stablish individual connections explicitly.

深海夜未眠 2024-09-06 13:18:15

RPC 和 RMI 之间的主要区别在于RMI 涉及对象。我们不使用代理函数来远程调用过程,而是使用代理对象

RMI 具有更大的透明度,即由于将技术集成到语言中,因此利用了对象、引用、继承、多态性和异常。

RMI 也比 RPC 更先进,允许动态调用(接口可以在运行时更改)和对象适应(提供额外的抽象层)。

The main difference between RPC and RMI is that RMI involves objects. Instead of calling procedures remotely by use of a proxy function, we instead use a proxy object.

There is greater transparency with RMI, namely due the exploitation of objects, references, inheritance, polymorphism, and exceptions as the technology is integrated into the language.

RMI is also more advanced than RPC, allowing for dynamic invocation, where interfaces can change at runtime, and object adaption, which provides an additional layer of abstraction.

四叶草在未来唯美盛开 2024-09-06 13:18:15

1.方法:

RMI 使用面向对象的范例,用户需要知道对象以及他需要调用的对象的方法。

RPC 不处理对象。相反,它调用已经建立的特定子例程。

2.工作:

使用 RPC,您可以获得看起来非常像本地调用的过程调用。 RPC 处理将调用从本地计算机传递到远程计算机所涉及的复杂性。

RMI 做同样的事情,但是 RMI 传递对对象和正在调用的方法的引用。

RMI = RPC + 面向对象

3.更好的方法:

与 RPC 相比,RMI 是一种更好的方法,尤其是对于较大的程序,因为它提供了更清晰的代码,更容易识别是否出现问题。

4.系统示例:

RPC 系统:
SUN RPC、DCE RPC

RMI 系统:
Java RMI、CORBA、Microsoft DCOM/COM+、SOAP(简单对象访问协议)

1. Approach:

RMI uses an object-oriented paradigm where the user needs to know the object and the method of the object he needs to invoke.

RPC doesn't deal with objects. Rather, it calls specific subroutines that are already established.

2. Working:

With RPC, you get a procedure call that looks pretty much like a local call. RPC handles the complexities involved with passing the call from local to the remote computer.

RMI does the very same thing, but RMI passes a reference to the object and the method that is being called.

RMI = RPC + Object-orientation

3. Better one:

RMI is a better approach compared to RPC, especially with larger programs as it provides a cleaner code that is easier to identify if something goes wrong.

4. System Examples:

RPC Systems:
SUN RPC, DCE RPC

RMI Systems:
Java RMI, CORBA, Microsoft DCOM/COM+, SOAP(Simple Object Access Protocol)

春风十里 2024-09-06 13:18:15

远程过程调用 (RPC) 是一种进程间通信,它允许调用驻留在本地或远程计算机中的另一个进程中的函数。

远程方法调用(RMI)是一个API,它在Java中实现RPC并支持面向对象的范例。

  1. 您可以将调用 RPC 视为调用 C 过程。 RPC 支持原始数据类型,而 RMI 支持方法参数/返回类型作为 java 对象。

  2. 与 RPC 不同,RMI 易于编程。您可以根据对象而不是原始数据类型序列来思考业务逻辑。

  3. RPC 是语言中立的,与 RMI 不同,RMI 仅限于 java

  4. RMI 比 RPC 慢一点

看一下这篇文章,了解 C 中的 RPC 实现

Remote Procedure Call (RPC) is a inter process communication which allows calling a function in another process residing in local or remote machine.

Remote method invocation (RMI) is an API, which implements RPC in java with support of object oriented paradigms.

  1. You can think of invoking RPC is like calling a C procedure. RPC supports primitive data types where as RMI support method parameters/return types as java objects.

  2. RMI is easy to program unlike RPC. You can think your business logic in terms of objects instead of a sequence of primitive data types.

  3. RPC is language neutral unlike RMI, which is limited to java

  4. RMI is little bit slower to RPC

Have a look at this article for RPC implementation in C

这样的小城市 2024-09-06 13:18:15

RMI 或远程方法调用是
与 RPC 或 Remote 非常相似
客户端中的过程调用
两者都将代理对象(或存根)发送到
服务器然而微妙
区别在于客户端 RPC
通过代理调用FUNCTIONS
函数和 RMI 调用方法
通过代理功能。 RMI 是
被认为稍微优越一点
面向对象的 RPC 版本。


来自此处

如需更多信息和示例,请查看此处

RMI or Remote Method Invokation is
very similar to RPC or Remote
Procedure call in that the client
both send proxy objects (or stubs) to
the server however the subtle
difference is that client side RPC
invokes FUNCTIONS through the proxy
function and RMI invokes METHODS
through the proxy function. RMI is
considered slightly superior as it is
an object-oriented
version of RPC.

From here.

For more information and examples, have a look here.

╭⌒浅淡时光〆 2024-09-06 13:18:15

RPC 和 RMI 之间唯一真正的区别在于 RMI 涉及对象:我们不是通过代理函数调用函数,而是通过代理调用方法。

The only real difference between RPC and RMI is that there is objects involved in RMI: instead of invoking functions through a proxy function, we invoke methods through a proxy.

青柠芒果 2024-09-06 13:18:15

RMI 和 RPC 的区别在于:

  • RMI顾名思义就是远程方法调用:它调用一个方法或一个对象。
  • RPC 它调用一个函数。

The difference between RMI and RPC is that:

  • RMI as the name indicates Remote Method Invoking: it invokes a method or an object. And
  • RPC it invokes a function.
海的爱人是光 2024-09-06 13:18:15

RPC 是一种基于 C 的旧协议。它可以调用远程过程并使其看起来像本地调用。RPC 处理将远程调用传递给服务器并将结果传递给客户端的复杂性。

Java RMI 也实现了相同的功能,但略有不同。它使用对远程对象的引用。因此,它所做的是发送一个引用到远程对象以及要调用的方法的名称。这样做更好,因为在大型程序的情况下,它可以生成更清晰的代码,并且通过网络分发对象使多个客户端能够调用服务器中的方法,而不是单独建立每个连接。

RPC is an old protocol based on C.It can invoke a remote procedure and make it look like a local call.RPC handles the complexities of passing that remote invocation to the server and getting the result to client.

Java RMI also achieves the same thing but slightly differently.It uses references to remote objects.So, what it does is that it sends a reference to the remote object alongwith the name of the method to invoke.It is better because it results in cleaner code in case of large programs and also distribution of objects over the network enables multiple clients to invoke methods in the server instead of establishing each connection individually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文