I am a little bit confussed, and hoping you guys can help me out. I am working with RMI, and I don't know how many instances are created for Remote Objects. This is in regards to the Developer's exam, but as RMI in general, that's why I posted here. OK, I have an object that is bound in the registry. If multiple clients lookup the object, does each client get their own version of the object, or is there still only one object? If there is only one object, how do I make the server create some kind of class on the server as a remote object, that stays on the server, but the client can call methods on. Or is it like the RMI tutorial at Sun that has a Task object that is passed back to the server that is implementing and interface that has a method called executeTask(). Thanks for your help Mark
Mark, There is only one remote object, but each client gets its own proxy for it. When the client "calls the remote object", it really calls the stub (a GoF proxy object). The stub causes the call information to be serialized and sent over the network. The RMI server receives this, deserializes it, and it ends up at the skeleton which then calls the "real" remote object. The value returned follows the opposite path. - Peter
OK, then the proxy object for each client has a Collection(Hashtable) of locks for the client, and only that client. Thanks Mark Spritzler
Peter den Haan
Joined: Apr 20, 2000
Originally posted by Mark Spritzler: OK, then the proxy object for each client has a Collection(Hashtable) of locks for the client, and only that client.
No. The stub is completely transparent to you and has no visible state of its own, all it does is forward method calls to the "real" object. If your remote object has a eollection, there is just one copy of it: on the server. - Peter
Thanks Peter. I also found that out last night when I tested it at home. I had two clients running, and they locked records 1 & 2for the first client, then 3 & 4 for the second client, and when I returned the Vector, it had all four record locks in it. I will need this feature to keep track of all locks by all clients, but I guess I need a solution to ID them, like each client has it's own object, on the client, that tracks the records they have locked, so that they can only unlock their records. Thanks Mark