Remote Method Invocation (RMI), Stubs, Skeletons in Java

Remote method invocation: RMI can be used to call a method remotely from another system. RMI is used to build distributed applications. Arguments with simple type and objects can be accepted by remote methods. Whenever an object is passed as an argument to remote method, it is serialized, and then sent to remote system. RMI uses stubs and skeletons for performing tasks. Stubs and skeletons can be created by using a RMI compiler.

Stub: It is an object which is present in the client system. It implements same interfaces as remote server. Whenever a client initiates a remote method call it is sent to the stub. Then, this call is processed by stub and a request is sent to remote system.

Skeleton: It is an object which is present in the server system. It is used for receiving requests, and calling codes on server. It is also used for deserialization.

Leave a Reply