热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

RMI 面试题与答案

问题 11. Discuss in brief about Remote Method Invocation (RMI) and its working.

RMI is a java object equivalent process that invokes a method in a distributed environment.

RMI performs the communication among objects using object-to-object communication. RMI uses the objects distribution techniques and invokes methods of objects which are located in a remote site.

Working of RMI:

The code from machine A is being accessed for the object that is residing on machine B in a remote relocation. There are two intermediate objects called a 'stub' and a 'skeleton', which actually handles the communication. The following are the tasks that performed by these two objects:

Task that are to be handled by the stub object (on machine X):

* Building a information block which consists of
- an identifier of the remote object
- an operation number that describes the method to be called and
- the method parameters called marshaled parameters that are to be encoded into a suitable format for transporting over the network
* Sending the information to the server.

The tasks that are to be handled by the skeleton object (on machine Y) are:

* Unmarshalling the parameters
* Invoking the required method of the object which is lying on the server
* Capturing and returning the value if successful or an exception if unsuccessful , after the call on the server
* Marshalling the returned value
* Packaging the value that is in the marshaled form and sending to the stub on the client.

Subsequently the stub object unmarshals the return value or exception from the server as the case may be. This is the returned value of the remote method invocation. If an exception is thrown, the stub object will rethrow the exception to the caller.

这有帮助吗? 添加评论 查看评论
 

问题 12. What is the difference between RMI and JMS?


RMI

* RMI is tightly-coupled mechanism.
* The destination object need to be available online at the time of sending messages from client to server.
* RMI has RPC-model

JMS

* JMS provides loosely coupled mechanism.
* The destination object need not be available online at the time of sending messages from client to server.
* JMS has messaging model.

这有帮助吗? 添加评论 查看评论
 

问题 13. 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.

这有帮助吗? 添加评论 查看评论
 

问题 14. Explain how URL convention is used for accessing the registry.

The class rebind () method of java.rmi.Naming class is used to specify the port number . For example if the registry is running on a port number 3271 of an application named HelloRMIRegistry the following is the usage of the URL to reference the remote object:

Naming.rebind ("//host:1111/RMIRegistry", obj);

The URL stored on the web page needs to specify the non-default port number.
When the server’s remote objects created by the server can include the URL from which the stub class can dynamically be downloaded to the client. The following example depicts this:

java -Djava.rmi.server.codebase=http://host/username/codebase/examples.ExampleRMIURL

这有帮助吗? 添加评论 查看评论
 

问题 15. 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.

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。