-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Increasing a counter between threads
PostPosted: Sun Oct 17, 2004 1:43 pm 
Newbie

Joined: Thu Sep 25, 2003 7:21 pm
Posts: 17
Suppose you have an object on which you can cast a vote, this object maintains it's own vote count

In normal java one would synchronize the addVote method to ensure you don't lose votes Obviously this would be pointless in hibernate where objects are transaction scoped.

Pessimistic locking won't scale, so I guess you'd have to use optimistic locking, however when someone presses a cast vote button, you can't really serve them a stale data error please vote again dialog if the locking failed

I and I am kind of hessitant to just retry load -> add -> save untill it doesn't throw an exception, because if you don't make some elaborate max retry system, potentially it could bring the entire system down, would this really be the best option ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.