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.
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:
- It initiates a connection with remote Virtual Machine (JVM),
- It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
- It waits for the result
- It reads (unmarshals) the return value or exception, and
- It finally, returns the value to the caller.
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:
- It reads the parameter for the remote method
- It invokes the method on the actual remote object, and
- It writes and transmits (marshals) the result to the caller.
Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects
SILAN Technology, BBSR Call to: 9439202111 | 9658317757 | 0674-2361252