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:
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: