java – What is the difference between RMI and JRMP?

Question:

I only know RMI… Is JRMP just a different way of calling RMI or is it another protocol?
In case JRMP is another protocol, how is it different from RMI?

Answer:

RMI

The RMI ( Remote Method Invocation ) is a programming interface that allows the execution of remote calls in RPC style in applications developed in Java . It is one of the Java platform approaches to providing the functionality of a distributed object platform. This distributed object system has been part of the basic core of Java since the JDK 1.1 version, with its API being specified through the java.rmi package and its subpackages.

Through the use of the RMI architecture, it is possible that an active object in a Java virtual machine can interact with objects from other Java virtual machines, regardless of the location of these virtual machines.

JRMP

JRMP ( Java Remote Method Protocol ) is the Java technology specific protocol for looking up and referencing remote objects. It is a wire-level protocol working at a level below RMI (RMI) and over TCP/IP.

RMI System Software Layers

The RMI implementation is essentially made up of three layers of abstraction. The Stub and Skeleton layer is under the developer's eyes. This layer intercepts method calls made by the client so that the interface's reference variable redirects those calls to the remote RMI service.

The next layer is the Remote Reference Layer . This layer knows how to interpret and manage references made by clients to remote service objects. The connection from the client to the server is Unicast (one-to-one).

The transport layer is based on TCP/IP connections between machines on a network. Using this layered architecture, each of the layers could easily be improved or replaced without affecting the rest of the system. For example, the transport layer could be replaced by a layer that implements UDP/IP connections without affecting the upper layers.

This layer directly handles the communication between the various JVM's, using TCP/IP. It is important to note that even if the JVM's run on the same computer, RMI always uses TCP/IP communication. This means that it is always necessary to have a working network interface to be able to use RMI (even with the client application and the server application running on the same computer). On the TCP/IP stack, RMI has a protocol called JRMP, which allows overcoming some obstacles that may arise in network communication via TCP/IP. For example, JRMP allows multiplexing several TCP/IP connections into a single TCP/IP connection, overcoming constraints of using only one connection in some environments (ex.: certain browsers running RMI Applets)

Isn't Java RMI exactly a transport protocol?

No. Java RMI is a set of APIs and a model for remote objects that allows developers to easily build distributed applications in Java. For example, it uses normal Java interfaces to define remote objects in a separate language like IDL. Typically Java RMI uses a combination of Java serialization and the Java Remote Method Protocol (JRMP) to convert the normal appearance of a method into a remote method invocation.

With Java RMI, JRMP will continue to support and improve the native protocol for Java RMI.

What is a transport protocol?

A transport protocol defines a set of message formats that allow data to be passed across a network from one computer to another. Java RMI supports its own transport protocol (JRMP) and other industry standard protocols including IIOP.

See more at: Java: Remote Method Invocation

Scroll to Top
AllEscort