1

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

4

1 回答 1

2

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.)

于 2013-07-12T11:28:08.813 回答