Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Vector instances

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Steve Brailsford
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic