I trying to determine the best way to have it that when a user is editing her/his profile that no one else can edit that profile.
EG.
User A clicks on edit profile. Meanwhile, the Admin clicks to edit User A's profile. Since, User A is currently editing the profile the Admin is told to try again later.
Design Constraints
* User profile is represented by an CMP 2.0 entity bean (with local interfaces).
* The user profile is returned to the JSP as a value object (UserProfileDTO) from a stateless session bean
Time-outs can be used to prevent deadlocks. But if a lease was to be used that had to be renewed say every 30 minutes, how could you do this from the thin client?
Please do not suggest optimistic locking (versioning, timestapping) as I would like exclusive access to editing. That is, others can view the profile while it is being modified, but only one user can edit the profile at a time.
So basically, how can I get exclusive write access and still allow read access? and how is the problem deadlocks to be solved in this situation?
-
Acquiring write lock problem (3 messages)
- Posted by: Cameron Zemek
- Posted on: December 24 2002 05:52 EST
Threaded Messages (3)
- Acquiring write lock problem by Kiran Kadambi on December 26 2002 23:11 EST
- Acquiring write lock problem by Cameron Zemek on December 27 2002 19:04 EST
- Acquiring write lock problem by Justin Van Vorst on January 02 2003 15:44 EST
-
Acquiring write lock problem[ Go to top ]
- Posted by: Kiran Kadambi
- Posted on: December 26 2002 23:11 EST
- in response to Cameron Zemek
One simple thing that i can think of is to have a field in your db or put a variable in session(if u are developing a web based app). When ever one needs to access that particular user's record, one has to perform a lookup on this field or variable, change its status if availaible and update the same in session or db.
Hope this helps,
Kiran Kadambi -
Acquiring write lock problem[ Go to top ]
- Posted by: Cameron Zemek
- Posted on: December 27 2002 19:04 EST
- in response to Kiran Kadambi
Thanks for the reply, but it doesn't help me much. I really need to know how to implement the leasing service without deadlock problems. That is how do I implement the timeout and renewing of leases, especially from a web client (JSP/Servlet client)?? -
Acquiring write lock problem[ Go to top ]
- Posted by: Justin Van Vorst
- Posted on: January 02 2003 15:44 EST
- in response to Cameron Zemek
"Please do not suggest optimistic locking (versioning, timestapping) as I would like exclusive access to editing."
Ummm... perhaps pessimistic locking would work? I'm still amazed at how often this issue comes up.