Hi guys,
In RMI, objects can be passed by value or by reference(when u say by reference, this means ur class implements java.rmi.Remote.. and here comes the concepts of stubs and skeletons..)
1. I/f is remote.
In the problem that we are dealing with the object is a passed by value.. a copy of the list object is made and passed to the remote class..the object at the client and server are no longer same (The object recd at the server side is a copy of the object at the client) so any changes made to the copy will not be reflected at the client simply becuase it is a different object all together ..So size will remain 0(assuming that nothing was added to the list before calling the method)
I hope u understood this.
2.Local i/f
Here when the method is called the reference to the object is passed by value(now both of them refer to the same object.
The number of elements is now 1.
Sorry for my mistake !
QUOTE]Originally posted by sandy ind:
Hi there guys,
I think that i understood the problem correctly but still do correct me if i am wrong. Mr. Bhat, wrong when u say that objects are passed by value in the remote and home i/f. It is actually the reference or the handle(pointer in c++) to THE Object that is tossed around(passed by val) and not the object itself. So when u add to a List or whatever that was, the count should increase and after the addmethod is done, if u want to say getCount, it should give u the count++.
Thanks
Sahil