Remote Method Invocation

Why Trust Techopedia

What Does Remote Method Invocation Mean?

Remote method invocation (RMI) is a distributed object technology developed by Sun for the Java programming language. It is available as part of the core Java application programming interface (API) where the object interfaces are defined as Java interfaces and use object serialization.

Advertisements

RMI permits Java methods to refer to a remote object and invoke methods of the remote object. The remote object may reside on another Java virtual machine, the same host or on completely different hosts across the network. RMI marshals and unmarshals method arguments through object serialization and supports dynamic downloading of class files across networks.

Techopedia Explains Remote Method Invocation

Remote method invocation was first introduced in Java Development Kit (JDK) 1.1 and is extensively used in distributed object computing. It performs the object-oriented equivalence of remote procedure calls. RMI functionalities come in a java.rmi package and provide a distributed object capability for Java-based applications.

RMI architecture extends the robustness and safety of Java architecture to the distributed computing world. RMI allows the that code defines and implements the behavior to remain on different Java virtual machines. Remote services in RMI are coded using a Java interface where the implementation is coded in a class. In the first class, implementation of the behavior runs on the server. The second class runs on the client and acts as a proxy for the remote service.

RMI implementation is built from three abstract layers – the stub and skeleton layer, the remote reference layer and the transport layer. The stub and skeleton layer is just below the view of the developer. Stub and skeleton objects are used to provide a connection between the client and remote object. A stub forwards method invocations from the client to the server and is aware of how to communicate with the stub across the link. Therefore, it acts as a proxy where the remote object implementation resides. Reference to the remote object by a client is literally a reference to the local stub. The client houses a local copy of the stub object. Skeletons hold methods, which dispatch calls to remote object implementation.

The steps in designing an RMI application are:

  1. Define remote interfaces and implement client and remote objects.
  2. Compile the source and generate stubs and skeletons.
  3. Make required class networks accessible.
  4. Run the application.
Advertisements

Related Terms

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.