• 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

URLy BIRD : record level locking vs file level locking

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
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 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Andrew. It makes sense while thinking using the physical and logical views.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic