Thursday, March 12, 2009

When a local object is serialized and passed as a parameter in an RMI

Question :When a local object is serialized and passed as a parameter in an RMI
call, are the byte codes for the local object's methods also passed? What
about object coherency, if the remote VM application "keeps" the object
handle? (CoreJava)

Answer :The bytecodes for a local object's methods are not passed directly in the
ObjectOutputStream, but the object's class may need to be loaded by the
receiver if the class is not already available locally. (The class files
themselves are not serialized, just the names of the classes.) All classes
must be able to be loaded during deserialization using the normal class
loading mechanisms. For applets this means they are loaded by the
AppletClassLoader.
There are no conherency guarantees for local objects passed to a remote
VM, since such objects are passed by copying their contents (a true passby-
value).

No comments: