Logo F2FInterview

RMI Interview Questions

Q   |   QA

RMI uses a mechanism that is standard for all the system and it is used to communicate with all the remote objects that are available. So, stubs are used to store the objects in the database so that it can be used later on. A stub is used for remote objects that act as a client’s local proxy for the remote object. This way the caller of the object calls the method on the local stub that becomes responsible to carry out the method call on the remote objects. RMI uses stub for a remote object that implements the same set of remote interfaces that is implemented by remote object. The stub is used to initiate the connection between the object and the java virtual machine. It marshalls that includes write and transmit the parameters to the remote java virtual machine that includes the method invocation. It allows the unmarshalling of the object to return the true value or the exception to be returned to the caller. The stub is used to hide the serialization of the parameter at network-level for the communication to be proceeded without any disturbance.

Every object that can be remotely accessed have a corresponding skeleton that functions like the original object. It is responsible for dispatching the call that is made to the actual remote object for the implementation and allow it to be implemented using the services provided by RMI. It allows the incoming method invocation to unmarshals i.e. only read the parameters used for the remote method. It invokes the method that is used by the actual remote object and after implementation marshals the result to the caller who is the original caller for the object.

RMI uses different parameters with values and exceptions and they all has to be passed for RMI calls. It creates the object that is serializable. RMI uses the serialization mechanisms to transfer the data from one machine to another using the virtualization concept. This is done so that the caller can receive the files on time. When the parameters return the values of the method invocation and unmarshals it then the live objects gets received by the java virtual machines.

The unmarshalling process tries to resolve the name issue of the classes by loading the context class using the current thread. RMI provides the dynamic loading of the class definition to be done using actual types of objects that are passed as parameters and return values for RMI. This allows the dynamic loading of the remote stub classes that are related to a particular remote object that takes part in implementation of the classes. RMI also uses special subclasses of java.io.ObjectOutputStream and java.io.ObjectInputStream for marshilling and unmarshalling. 

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: