• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FBNS - Lock and Unlock .. confused

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
I have read several posts on this method. But unfortunately I don't understand the basics of these 2 methods properly. Please guide me.
Locking is one step prior to booking, right? A client is shown a table consisting of the requested flight schedules. When he selects a record from the table and clicks on "book", then the record is supposed to be locked, which means another client who wants to book the same flight cannot access it if it has just " 1 "available seat. Else, booking can be made "simultaneously" by as many clients as there are number of seats???
Ok, once the booking is completed by a client, the lock is released, and this is 'unlock'??
What is the meaning of "the entire databse getting locked"?? All the records are selected by clients?
About read(), modify() and write(), modify() is updating the seats after a booking made by the client??? What is read(), write() and add()? Who would add a new record to the database (certainly not the client)?
How should I implement record selection? Do I need to provide a radiobutton in each row and let the client choose one?
That was a lot of questions!!! I'm sorry .. I'm not clear about these. Please help!!!
Thanks
Nandini
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMO, anytime a client want to bookflight, he should lock the record to be booked, no matter how many seats are available.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nandini,
When ever a record is to be modified it better follow the sequence lock-->read-->modify-->unlock
your present implementation may not support add and delete functionality. If FBNS decides to extend your application to give this functionality to certain users, add and delete methods should lock the entire database before modifying the it. Also, as some people have suggested locking the entire database could be done just before shutting the server down.
This is just my interpretation of the instructions.
Regards
badari
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini,
Typically locking the entire database would be done for some major event: shutting down the server, or performing a backup of the database. You don't necessarily have to code for either example I gave, but it may help to understand where they could be used.
You might also lock the entire database to perform an add of a record, and that is probably the easiest way to ensure a safe networked add method with the version of Data that we have been given. But there are ways of doing add that are not so detremental to the performance of any other clients, such as allowing your lock method to accept a record number 1 greater than the maximum number of records in the database.
Again - you don't have to code any functionality into your client to support adding records, but it does have to present in your networked server.
I would not bother to lock the entire database for a delete. What will this gain you that locking the individual record wont give you?
Regards, Andrew
 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
I have not been into the networking uptil now, but just concentrating on the basic GUI and getting the table display of the schedules via criteriaFind().
When I now move onto the lock() and unlock(), should I do the networking simultaneously?
Please advise.
Thanks
Nandini
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nandini
There are two schools of thought here:
  • Do locking regardless of whether you are in networked mode or not. It will be redundant in local mode, but at least the same actions will always occur no matter what mode you are in.
  • Only do locking in networked mode. That way you are not using redundant code.


  • Time for a design decision.
    Once you have decided which way you feel comfortable with - then build your code accordingly.
    Regards, Andrew
    reply
      Bookmark Topic Watch Topic
    • New Topic