Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FBNS - Lock and Unlock .. confused

 
Nandini Sriram
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • 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
 
Xiao Qinglai
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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.
 
badari gururaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • 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
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic