Mastering EJB 2E.中一个关于RMI-IIOP的问题
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