If a class implements both the Serializable and Remote interfaces, is the stub serialized and sent to the client or is the object?

Tim Rohaly

If an object implements java.rmi.Remote, then it is treated as a remote object - that is, its stub is serialized and sent to the client. This is true whether or not the object also implements java.io.Serializable.

If the object is not an instance of java.rmi.Remote, then RMI will attempt to serialize the object itself. This will succeed only if the object is serializable, i.e. implements java.io.Serializable or java.io.Externalizable.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact