URLy BIRD : record level locking vs file level locking
Joined: Oct 12, 2004
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 ]
author and jackaroo
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.