Local vs. Remote Objects
The goal is for local and remote objects to be semantically the same.
For Java, an important issue is garbage collection, which automatically deallocates memory for local objects. Remote objects are also garbage collected as follows:
- Remote reference layer on the server keeps reference counts for each object in Remote interface.
- Remote reference layer on the client notifies the server when all references are removed for the object
- When all references from all clients are removed, the server object is marked for garbage collection.
One difference between local and remote method calls is that objects are passed to local method calls effectively by reference, whereas they are copied via the serialization technique to pass to remote method calls.