Passing Objects in RMI
by, 07-07-2012 at 06:20 PM (1109 Views)
Argument to the return values could be of any type including remote objects, primitive data type, and local objects. It could be said more precisely that any type’s entity could be passed from or to remote method, as long as this entity would be considered as a type’s instance which is primitive type, aserializable object, or a remote object, that shows that interface java.io.Serializable would be implemented.
There are few object types that are not upto any criteria and hence are not returned from or passed to the remote method. Majority of such object like file descriptors or threads, would capsulate the data which just makes sense in one address space. Majority of the core classes present including packagesjava.lang and java.util classes play their role in implementation of the Serializable interface.
How return values and arguments would be passed has certain rules, as following:
- Remote objects would be passed via reference. Remote reference object is basically a stub that is a proxy of client side to do the implementation of the complete remote interfaces set.
- Local objects would get passed by the help of copy by using object serialization. All fields by default are copied, except those fields that have been market transiet or static.