Câu hỏi phỏng vấn Java
Câu hỏi

What is the role of stub in RMI?

Câu trả lời

In Java Remote Method Invocation (RMI), the stub plays a crucial role as the client-side representation of the remote object. The primary function of the stub is to act as a proxy or gateway for the client, handling all outgoing requests to the server where the actual remote object resides[1][2][3][4][5][6][8].

Key Functions of the Stub in RMI

  1. Communication Interface: The stub serves as the intermediary between the client application and the remote object on the server. It provides the client with a local representation of the remote object, allowing the client to invoke methods on the server-side object as if it were local[1][2][3][4][5][6][8].

  2. Marshalling of Requests: The stub is responsible for marshalling, which involves packaging the method calls along with their associated parameters into a form suitable for network transmission. This process includes serializing the parameters into a byte stream[2][3][6].

  3. Network Transmission: After marshalling the data, the stub sends the method invocation request across the network to the server-side skeleton[2][3][4][5][6].

  4. Receiving and Unmarshalling Responses: Once the server processes the request and returns the result, the stub receives the response. It then unmarshals the response, which involves converting the received byte stream back into a suitable format or objects that the client application can use[2][3][6].

  5. Error Handling: The stub also plays a role in error handling by catching exceptions that may occur during the remote method invocation process. If an exception occurs on the server side during t...

middle

middle

Gợi ý câu hỏi phỏng vấn

entry

What is the difference between JDK and JRE?

middle

If an object reference is set to null , will the Garbage Collector immediately free the memory held by that object?

junior

What will happen to the Exception object after exception handling?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào