Passing remote parameters in RMI

北战南征 提交于 2019-12-24 08:56:50

问题


I would like to have confirm about RMI theory.

Let us suppose that Client A requests a remote reference of an object O to a Server B.

Well, now if In O interface (Interf) there is a method like: void foo(Interf obj);

When Client A calls O.foo(O) it passes stub reference (before received ) and then Server does not use its local reference but the Stub Object (received by Client), and so each call on O methods by Server will make use of its TCP/IP service.

Is it Ok?

You should feel free to add some details if you think that those can improve my RMI understanding.

Regards


回答1:


CORBA servers (as used to implement RMI/IIOP, not RMI/JRMP) typically implement a "colocated stub" optimization. That is, if a server invokes a method on a stub for an object that resides in that same process, the CORBA server will typically avoid TCP/IP and thread pool dispatch overhead. Instead, the parameters are copied, the method will be invoked on the target object, and the result object is copied and returned.

For reference, Java servers typically implement this optimization. The generated stub classes use the Util.isLocal method to determine if a stub target is local. Next, Stub._servant_preinvoke is called to obtain a reference/proxy to the local servant, and Util.copyObjects (or Util.copyObject) is used to copy parameters and return objects. (There are additional complexities with exception handling, RemarshalException, etc., but I've outlined the basic flow.)



来源:https://stackoverflow.com/questions/17531561/passing-remote-parameters-in-rmi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!