Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
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.
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.
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: