I have implemented the record locking control using a sync Vector in the Data class. Just had a thought, when the request hits the server it spawns a thread, initially etc.. and creates a new Data object based on the location pathname. This would mean I get a new Vector object with every requests, this does not seem right does it. Any help here please I would appreciate it. By the way using a Socket connection.
I think you need a single lock-tracking data structure that's shared between connections. I was wondering why you chose a Vector over a HashMap or HashTable with key = record number, and value = client id? One question: since you're creating a new instance of Data for each request, how do resolve having multiple RandomAccessFile's with 'rw' permission on the data file operating in a concurrent manner? BTW, is it legal for several RandomAccessFile instances to have 'rw' access to a file simulataneously?
posted 18 years ago
Hi Sajid, thank for the comments. I agree a single lock-tracking data structure such as making the Vector static, does that seem OK. I am using a Vector over HashTable/HashMap because the server is in control of the locking not the client and so I dont need the client ID. How could I control the updates through the Vector say when one client is using a different database to another client. This I feel is my last hurdle to overcome before submission.
Normally trees don't drive trucks. Does this tiny ad have a license?
Devious Experiments for a Truly Passive Greenhouse!