I've always assumed that there is some kind of synchronization taking place within the web server (tomcat ...) and that server would only process one request from a session at a time.
Adding synchronization can be very cpu expensive and if it's unwarranted, then it's a waste of valuable server resources... Paul Jackson -----Original Message----- From: T.Mikov [mailto:[EMAIL PROTECTED] Sent: Monday, 11 April 2005 1:10 PM To: Tapestry users Subject: Re: Synchronized access to the Visit object Andrus Adamchik wrote: > I don't think anything is broken. Most applications will survive users > who click too fast. For those that won't it is trivial to synchronize on > a session-scoped object outside of Tapestry using vanilla Servlet API, > e.g. via a ServletFilter. Broken is perhaps too strong, however unless I am wrong, the potential for a problem is there in existing examples. Take the Hangman application from "Tapestry in Action". In the Guess page it invokes Visit.makeGuess(), which invokes Game.makeGuess(), which modifies the game data. None of this uses any synchronization, so it is possible that two threads will be making concurrent modifications to the same data. In general this is a serious problem. It should never happen, except under very carefully controlled circumstances. Of course in this simple case probably nothing really bad will happen as a result. I have seen this pattern in other examples, some perhaps with potentially more serious problems. I haven't had time to analyze them. I just want to make sure that this is an omission for the sake of simplicity and there isn't some other mechanism taking care of synchronization behind the covers. regards, Tzvetan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
