What really gets passed when you pass an object to a remote method?
If your remote method has an argument that’s an object type, the argument is passed as a full copy of the object itself!
For remote calls, Java passes objects by object copy, not reference copy.
A serialized copy of the object is shipped to the Remote object.
Getting the object argument from the client to the server
Client invokes trainPet(myDog) on the stub, passing a copy of the reference to the Dog object.
The stub makes a serialized copy of the object and sends that copy over the wire to the skeleton.
Unpacking (deserializing) the object on the server
The skeleton deserializes the passed argument, creating a new Dog object in the Remote object’s heap.
The skeleton invokes the method on the Remote object, passing a plain old Java reference to the new Dog object.