This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
"Zhoucan"- This is your third notice. Please adjust your displayed name to meet the JavaRanch Naming Policy. You can change it here. Thanks! and welcome to the JavaRanch! Mark [ December 04, 2002: Message edited by: Mark Spritzler ]
Hi, I think the most widely used approach is to use the connection object itself as the client ID. This is the way I did it and I guess many others also. The idea is to issue a unique client connection object in remote mode using a RMI connection factory. This object reference is handed over until you access the database using the LockManager, the LockManager puts the object reference along with the record number in a Map. Hope this helps. jay ----- SCJP SCJD
Hi there, I worked quite a lot on this clientID work but I submitted my assignment with different design. And I was satisfied with my work when I got 51 out off 53 in server design. My approach was based on Spooler like tech. Apart from record no. being locked it also get spooled with the RecordSpooler class which implemented Spooler interface. This technique was helpfull in the case only that client was able to unlock the record who had actually acquired that lock. And if attempt was made by an connection who has not acquired a lock then that record will never be unlocked. thank's gurpreet
Joined: Oct 18, 2002
I think the most widely used approach is to use the connection object itself as the client ID.
How do you get the connection object reference? The return values of 'lookup' for two clients in my implementaion are equals. Please tell me how you force the server to return different objects for each client. Thanks Charles. [ December 08, 2002: Message edited by: Charles Dupin ] [ December 08, 2002: Message edited by: Charles Dupin ]
Joined: Sep 18, 2002
Returning a new client connection object which can also be used as the client ID can be achieved by using a factory pattern. This is the way I did it. I had a RMI Connection factory object which is registered as a service. Each client trying to access the database uses a local connection factory which contacts the RMI connection factory to return a remote connection object. Every connection object (local or remote) implements a DataClient interface which holds all public methods of Data. The returned object is the client ID, because each object is unique. The LockManager can use it for locking/unlocking. I used the client ID as the key in the LockManagers HashMap. Hope this helps. jay ------ SCJP SCJD