RMI Interview Questions and Answers
Intermediate / 1 to 5 years experienced level questions & answers
Ques 1. What is Registry Service for RMI?
The registration of the remote object must be done by the server in order for the client to look it up, is called the RMI Registry. In RMI, the client must contact an RMI registry, so that the server side application will be able to contact the client’s registry which points the client in the direction of the service. The client registers the service with the registry so that it is transparent to even for the server.
Ques 2. Explain how to bind an object to the registry.
If an object implements the java.rmi.Remote interface, an object is to be bound to registry context. Each registry context implements the Referenceable interface.
The object factory is implemented by the RegistryContextFactory which converts the registry references into the corresponding registry contexts or remote objects. To construct the registry constructs, the URL of the registry must be determined. In this way the remote objects will be bounded with registry contexts.
Ques 3. What is object serialization in RMI?
To marshal and unmarshall the parameters involves the object serialization and does not truncate types.
The methods of local object and their bytecodes are not passed directly in the ObjectOutputStream. At times the name of the class of the objects may be needed that is to be loaded by the receiver if at all the class is not available locally. Just like the names of the classes, the class files themselves will not be serialized. All classes must load during the process of deserialization using the normal mechanisms of class loading.
Ques 4. What is RMI callback mechanism?
When one service passes an object which is the proxy for another service, the RMI callback mechanism occurs. The methods will be invoked by the recipient in the object it received and be calling back to the calling point. The stub contains the information that is needed to call back to server at the time of the need.
Most helpful rated by users:
- What is RMI?
- What are the services in RMI ?
- Explain RMI Architecture?
- What is the difference between RMI & Corba?
- Does RMI-IIOP support dynamic downloading of classes?