Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLy BIRD : record level locking vs file level locking

 
jiju ka
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My instructions says:

What you must do
The following are the "top level" features that must be implemented:
1..
2 A data access system that provides record locking
3..


Further the interface insists

You must implement
public long lock(int recno)


I can accomplish the locking by record or file level locking. But does the two non functional requirements above, insist that I need to use Record level locking? Will I fail if I do File level locking?
[ December 16, 2005: Message edited by: jiju ka ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jiju,

At a functional (or business) level you must provide record level locking according to your instructions - both the explicit instruction you mentioned, and some implicit instructions (regarding concurrent multi user access).

So at a business-logic level, when I am in the process of booking record number 5 (for instance), I need to know that I have the ability to logically lock record number 5 so that no other client can book it. While it is logically locked, I can perform any business logic needed that requires the record to be locked.

As for physically locking the file itself (possibly via the java.nio.channels.FileLock class, it is worth noting the following warning in the API:
Whether or not a lock actually prevents another program from accessing the content of the locked region is system-dependent and therefore unspecified.


Regards, Andrew
 
jiju ka
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew. It makes sense while thinking using the physical and logical views.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic