2. On-demant: that is when you lock the record before updating it.
3. I had a big discussion with my colleges about the issue. We disagreed in our opinions what it exactly means. So, would better let somebody else comment it, than to provide with the false information.
What does locking mean in that sense ? Not allowing others to update/delete or search this item ?
The lazy client is described in the book as "closest strategy to ao an RDBMS, making it computationally expensive to assess which records are in use and which are free. Notification in such environments is usually required to be as quick as possible, seperate threading or not. The usual solution more memory, faster CPU, faster disks, seperate threading....". It is English, but I don't understand a flipping thing about the bold part. Can you say it in layman terms ?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
This is not to bad with the SCJD assignments, but it could be annoying (to say the least) if you spent half an hour entering relevant fields and then found out that the record has been booked in the meantime.
Note that since this is my interpretation of such a limited description, I could be totally wrong
quote:
----------------------------------------------------------------------------
What does locking mean in that sense ? Not allowing others to update/delete or search this item ?
----------------------------------------------------------------------------
update/delete for sure. Search is questionable. It depends on, which serialization level of transactions you want to have.
My implementation of the assignement allows to read a locked record.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I am not sure what your initial decision diamond is doing for you. I assume you are calling an isLocked() method on the server. But since you seem to be looping back to that decision, it is not really doing anything for you - you might as well replace it with a call to lock() the record.
Which brings me to the next point - you should lock the record before you check whether the record is deleted or already reserved. Otherwise there is a window of opportunity for another client to reserve the record before you complete the locking.
You may not need the separate decision diamond for checking if the record is deleted or not - the lock() method and isLocked() methods will probably do that check internally.
If it is not continue with the activity diagram; if it is the user is informed that the record is currently locked, and then what ??
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I just noticed the "throw RecordNotFound" case for when the record is already booked - that exception IMHO does not match the actual situation - you should be able to throw something more meaningful.
Personally I would wait a few seconds, then check if the record is still locked. Do that a few times, and if it still locked, present a dialog to the end user telling them that the record is locked and find out if they want to continue or not.
this is supposed to be a surprise, but it smells like a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|