Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When to acuire a pessimistic offline lock?

Status
Not open for further replies.

steverbs

Programmer
Jul 17, 2003
253
GB
Hi all.

I have been working on a lock-manager for one of our web-apps and have become a little lost. My problem is knowing where to acquire pessimistic offline locks on an Object. Each of my Objects are loaded using Static (Shared) getObject and getAllObjects methods, and are persisted using persist and destroy methods. Do I acquire the lock at the presentation level (when writing code in the WebForm Code-Behind files to work with Business Objects), or the business-architecure level (when reading and writing Business Object data through the Object persist and destroy methods)?

I am having the most trouble deciding when to get the locks and what to do once I have them. For example, if I have a webform named EditCustomer.aspx that works on a Customer Object, do I try to get the lock when the form is opened and the Customer is loaded so that no work is wasted if the lock can't be made? Or, do I try to get the lock once the form is submitted and the data is about to be updated? Do I add some code to the Object persist and destroy methods to check for a lock before throwing an error if the object is locked? I really need some guidance here as I can not find any resources that tell me what do with the locks.

Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top