MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
leebase
Post subject: Handling concurrency issues with web apps  PostPosted: Feb 07, 2005 - 04:05 PM
Veteran Member
Veteran Member


Joined: Mar 08, 2004
Posts: 127

Ok...here's a general development issue that conerns any web based app that is data entry oriented. I've been doing reporting systems so long, I've gotten a bit rusty with transactional development.

What's the best strategy for avoiding "last save wins" concurrency issues? If two people open a web maintenance page, change data, and save, the "last saved" wins, meaning the person who saved first loses their changes.

In the client server world, we'd simply lock the record when someone opened the screen....but you can't do that in a stateless web environment. How would you know the client logged off (or simply closed their browser)? The record could remain locked forever....not to mention you are using shared connections and only the "app server" has an account with the database.

Right now I have a plan for keeping a field with a "count"...that gets incremented when someone saves a change. But before a save occurs, the count is checked, and if it's not the same as when you opened the page, that means someone else has saved in the mean time, and you can inform the user that they need to refresh, and remake their changes.

Any better plan than this?

Lee
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 07, 2005 - 04:17 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23824

Lee,
I think your solution is elegant and simple. Bugzilla has implemented something like this for quite a while... I'm not privvy to the implementation details of it, but it is just how you describe "Oops, there is a conflict. Someone has changed this same record, if you wish to overwrite their changes say Yes, otherwise refresh your page" ssomething to that extent.

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits