Java / RMI
The Remote Method Invocation (Java RMI) is an API that provides a mechanism to create distributed application in java. The RMI allows an object to invoke methods on an object running in another JVM.
The RMI provides remote communication between the applications using two objects stub and skeleton.
The principle of RMI states that "definition of the behavior and the implementation of that behavior as separate concepts, RMI allows the code that defines the behavior and the code that implements the behavior to remain separate and to run on separate JVMs".
A remote object is a Java object whose method can be invoked from another JVM. RMI uses stub and skeleton object for communication with the remote object.
RMI uses stub and skeleton object for communication with the remote object.
The stub is an object, acts as a gateway to the client. It resides the client and acts as a proxy for the remote object.
The skeleton is an object, acts as a gateway to the server. All the client incoming requests are routed through the skeleton.
Stub and skeleton layer is responsible for intercepting method calls on the client interface and redirect it to remote RMI service method.
Remote reference layer manages and interprets the references from client to remote objects.
Transport layer is based on TCP/IP protocol and provides connection to 2 machines in a network and enables JVM to JVM connectivity to participate in RMI calls.Any Java interface that extends java.rmi.Remote is a remote interface. Remote interface methods can be invoked from another JVM and the object implementing this remote interface becomes remote object.