Meaningless Drivel is fun!*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Record Locking" Watch "B&S: Record Locking" New topic
Author

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.

Thanks,
-Shaifque
Rudolph Jen
Ranch Hand

Joined: Nov 17, 2006
Posts: 37
Hi.

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
R

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

SCJP<br />SCJD (in progress)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: Record Locking