Remote Method Invocation (RMI) and its working
Discuss in brief about Remote Method Invocation (RMI) and its working.- RMI is a java object equivalent process that invokes a method in a distributed environment.
- RMI performs the communication among objects using object-to-object communication.
- RMI uses the objects distribution techniques and invokes methods of objects which are located in a remote site.
Working of RMI:
- The code from machine A is being accessed for the object that is residing on machine B in a remote relocation.
- There are two intermediate objects called a ‘stub’ and a ‘skeleton’, which actually handles the communication.
- The following are the tasks that performed by these two objects:
1. Task that are to be handled by the stub object (on machine A):
A. Building a information block which consists of
- An identifier of the remote object
- An operation number that describes the method to be called
- The method parameters called marshaled parameters that are to be encoded into a suitable format for transporting over the network
B. Sending the information to the server.
2. The tasks that are to be handled by the skeleton object (on machine B) are:
- Unmarshalling the parameters
- Invoking the required method of the object which is lying on the server
- Capturing and returning the value if successful or an exception if unsuccessful , after the call on the server
- Marshalling the returned value
- Packaging the value that is in the marshaled form and sending to the stub on the client.
- Subsequently the stub object unmarshals the return value or exception from the server as the case may be. This is the returned value of the remote method invocation. If an exception is thrown, the stub object will rethrow the exception to the caller.
Discuss in brief about Remote Method Invocation (RMI) and its working.- Like RPC, RMI too is used to invoke methods located on a remote machine.
- With RMI, a client can hold references to remote objects so as to invoke its methods.
- The protocol needs to be extended to first send an object id across the socket, then the method and then the arguments.
- Then the server acts on the method of the object by using the id and method name.
RMI: What is RMI?
RMI - What is RMI?, Explain the advantages and disadvantages of RMI, Explain the architecture of RMI...
RMI Registry service
RMI Registry service - What is RMI?, Explain the advantages and disadvantages of RMI, Explain the architecture of RMI...