Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

An interesting problem

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all,
Suppose i run my FBN client (client A) in local mode. It attaches to a local db.db and tries to make bookings. Suppose another FBN client, client B (running in a different JVM, but on the same computer) attaches to the same db.db file and starts making bookings. I see a conflict here:
1. Client A grabs a record and determines it can deduct a certain number of seats from the booking.
2. Client B grabs a record and determines it can deduct a certain number of seats from the booking.
3. Client B deducts the seats and writes the updated record back to db.db.
4. Client A deducts the seats and writes the updated record back to db.db.
This, of course will produce an incorrect number of seats on the database in that particular record (i hope you all see why).
My question is this:
I understand why we need locking records between clients in remote mode - to prevent the situation i just described. But how can this situation be prevented in the case FBN clients (or in a more general case - unrelated programs) attempt to modify database? How can locking be done in this case?
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lev,
What you are attempting to do is not part of the requirements. I wouldn't worry about it.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i agree with sai -- this is not part of the specs.
actually, the same happens in remote mode when you start two servers using the same db file.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic