Mastering EJB 2E.中一个关于RMI-IIOP的问题

wang_zheng_wz 2004-07-06 10:34:13
Appendix A中有这句话
When invoking a method using RMI-IIOP, all parameters to the remote method are passed by-value.

又有这段话
In summary, we have the following rules for passing objects using Java RMI-IIOP:
■■ All Java basic primitives are passed by-value when calling methods remotely. This means copies are made of the parameters. Any changes to the data on the remote host are not reflected in the original data.
■■ If you want to pass an object over the network by-value, it must implement java.lang.Serializable. Anything referenced from within that object must follow the rules for Java serialization. Again, any changes to the data on the remote host are not reflected in the original data.
■■ If you want to pass an object over the network by-reference, it must be a remote object, and it must implement java.rmi.Remote. A stub for the remote object is serialized and passed to the remote host. The remote host can then use that stub to invoke callbacks on your remote object. There is only one copy of the object at any time, which means that all hosts are calling the same object.

他们矛盾吗?

另外,implementing java.lang.Serializable是pass by-value的充分条件吗?implementing java.rmi.Remote是pass by-reference的充分条件吗?如果parameter同时implement java.lang.Serializable和java.rmi.Remote,结果是pass by-value还是pass by-reference
...全文
73 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
leeak 2004-07-06
  • 打赏
  • 举报
回复
RMI IIOP 在序列化的时候有2种传值关系 就是 by value 和 by reference ,没有矛盾

具体在什么情况下用 我也记得不是很清楚了

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧