java rmi 参数传递,在RMI中传递远程参数

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

解决方案

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值