1.远程方法调用(RMI):
RMI应用程序提供两个单独的程序,一个服务器和一个客户端。服务器程序执行一些任务,即创建一些远程对象,对该对象进行引用并还等待客户端,以便它们调用这些对象上的方法。客户端程序获取对服务器上一个或多个远程对象的远程引用,并在其上调用方法。基本上,RMI提供了一种机制,服务器和客户端可以通过该机制进行通信并来回传递信息。 RMI由三层组成:
- 存根/骨架层
- 远程参考层
- 传输层
这些层之间的关系如下图所示:
2.通用对象请求代理体系结构(CORBA):
它是对象管理小组开发的用于在分布式对象之间提供互操作性的标准。它是世界领先的中间件解决方案。它使信息交换,独立的硬件平台,编程语言和操作系统成为可能。它通常被定义为“软件总线”,因为它是基于软件的通信接口,通过该接口可以定位和访问对象。
RMI和CORBA之间的区别:
RMI | CORBA |
---|---|
RMI is a Java-specific technology. | CORBA has implementation for many languages. |
It uses Java interface for implementation. | It uses Interface Definition Language (IDL) to separate interface from implementation. |
RMI objects are garbage collected automatically. | CORBA objects are not garbage collected because it is language independent and some languages like C++ does not support garbage collection. |
RMI programs can download new classes from remote JVM’s. | CORBA does not this code sharing mechanism. |
RMI passes objects by remote reference or by value. | CORBA passes objects by reference. |
Java RMI is a server-centric model. | CORBA is a peer-to-peer system. |
RMI uses the Java Remote Method Protocol as its underlying remoting protocol. | CORBA use Internet Inter- ORB Protocol as its underlying remoting protocol. |
The responsibility of locating an object implementation falls on JVM. | The responsibility of locating an object implementation falls on Object Adapter either Basic Object Adapter or Portable Object Adapter. |