[NSWI080] RMI - method calls on server-returned objects
Jakub Pelc
jakub.pelc at email.cz
Wed Mar 8 11:57:41 CET 2023
Hello,
I have a question regarding Task 1 subtask 3 (local searcher, remote nodes):
in the remote node factory, should the returned Node objects be exported?
Should I simply 1) `return new NodeImpl();` or 2) export the new NodeImpl
first and returned the exported object?
As far as I know, the first would just return the Node object serialized (I
modified the Node interface to extent both Remote and Serializable), but
constructing the graph edges on the client with deserialized Nodes would
just create the graph locally, whereas the second option would cause the
client to work with Node stubs, where method calls are passed to the server,
so when client creates edges, they would correctly be created on the server-
side node objects.
Is this assumption correct?
It is not entirely clear to me how the Remote interface and object exporting
interact with passing/returning such objects to remote methods, eg. whether
the Remote interface is enough to cause the object's methods to be run at
the object's machine of origin instead of the local machine, or if the
object also needs to be explicitly exported.
Another problem is that when using the second approach, I sometimes get
inconsistent distances when measured on identical local and remote node
graphs, so I guess my assumption might be wrong, but the second approach is
also much slower, implying many roundtrips between client and server, which
implies that my assumption is correct.
Thank you,
Jakub Pelc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://d3s.mff.cuni.cz/pipermail/nswi080/attachments/20230308/5d3d88f0/attachment.htm>
More information about the NSWI080
mailing list