tags:

views:

216

answers:

2

Trying to get an understanding on how the RMI is working (I have a simple application that uses RMI and seems to work just fine).

My question is : What happens when an rmi call is made? What happens on the way from an rmi client to an rmi server?

+1  A: 

RMI is the object oriented approach for RPC.

There is a Stub in client side and a Skeleton in server side. Client and Server does not directly communicate but they communicate over Stub and Skeleton which are generated automatically..

As you might guess there must be some objects both Server and Client have to use. These objects are defined in Server side and hold in RMI Registry. Both server and client can call RMI registry and it works as a memory somehow (It is not a Memory this is an example just to be clear). Server binds an object to registry and client invokes methods on it.

JCasso
+1  A: 

Hi Zka,

after the lookup described above, the objects used as parameters in a rmi call are serialized (Marshalling) that means a byte by byte representation of the objects non transient data will be send over the network connection. On server-side the serialized data will be unmarshalled and the objects will be instantiated. After that the server-side method is invoked, return values will be returned in a similar way as parameters have been previously send. It is similar to writing an object into a file.

http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html

stacker