Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

RMI(Remote Method Invocation)

To develop a distributed application in java, we use RMI mechanism. RMI is an API that provides a mechanism to create distributed application. The RMI allows an object to invoke methods on an object running in another machine(JVM).
It is providing a facility where remote communication is doing between the applications using two objects stub and skeleton. So let’s first understand about stub and skeleton.
RMI uses stub and skeleton object for communication with the remote object.
A remote object is an object whose method can be invoked from another JVM.

stub

The stub is an object present in client side. Basically it is a proxy object that means it represents the remote object. It acts as a gateway for the client side. When a method is invoked on the stub object, then it performs following tasks:

  1. It initiates a connection with remote Virtual Machine (JVM),
  2. It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
  3. It waits for the result
  4. It reads (unmarshals) the return value or exception, and
  5. It finally, returns the value to the caller.

skeleton

The skeleton is an object, acts as a gateway for the server side object. All the incoming requests are routed through it. When the skeleton receives the incoming request, it does the following tasks:

  1. It reads the parameter for the remote method
  2. It invokes the method on the actual remote object, and
  3. It writes and transmits (marshals) the result to the caller.

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext