*** Welcome to piglix ***

Remote Method Invocation


In a distributed computing environment, distributed object communication realizes communication between distributed objects. The main role is to allow objects to access data and invoke methods on remote objects (objects residing in non-local memory space). Invoking a method on a remote object is known as remote method invocation or remote invocation, and is the object-oriented programming analog of a remote procedure call.

The widely used approach on how to implement the communication channel is realized by using stubs and skeletons. They are generated objects whose structure and behavior depends on chosen communication protocol, but in general provide additional functionality that ensures reliable communication over the network.

In RMI, a stub (which is the bit on the client) is defined by the programmer as an interface. The rmic compiler uses this to create the class stub. The stub performs type checking. The skeleton is defined in a class which implements the interface stub.

Distributed object communication.png

When a caller wants to perform remote call on the called object, it delegates requests to its stub which initiates communication with the remote skeleton. Consequently, the stub passes caller arguments over the network to the server skeleton. The skeleton then passes received data to the called object, waits for a response and returns the result to the client stub. Note, there is no direct communication between the caller and the called object.

In more details, the communication consists of several steps:


...
Wikipedia

...