File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Record Locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Record Locking" Watch "B&S: Record Locking" New topic

B&S: Record Locking

Muhammad Shafique
Ranch Hand

Joined: Sep 30, 2006
Posts: 59
Hi There,
I read many posts about record locking where people talked about "Locking Manager" which seems a/some class(es). Of course, we don't need locking in "alone" mode. I am using a simple hash map data structure which stores record number as key object and client info as value object. This map resides in the db access file which handles all requests from different clients. Only one object of this class is created. I wonder this aproach may not be good in terms of future enhancments, code understanding etc. Please comment and kindly let me know if there is a better approach like how to think about writing a locking manager.

Rudolph Jen
Ranch Hand

Joined: Nov 17, 2006
Posts: 37

By "client info as value object" you mean the lock cookie, right? Because that is IMHO all "client info" you need.

I also use an extra Object (only once created) to manage my locks in a multi threaded environment. That has to be the way to achieve a high cohesion in your code.

After some tests, I got an good feeling about that.

Best Regards

[ January 23, 2007: Message edited by: Rudolph Jen ]
[ January 23, 2007: Message edited by: Rudolph Jen ]

SCJP<br />SCJD (in progress)
jQuery in Action, 3rd edition
subject: B&S: Record Locking
jQuery in Action, 3rd edition