Grails/Spring HttpServletRequest synchronization
- by Jeff Storey
I was writing a simple Grails app and I have a spot in a gsp where one of my java beans in modified.
<g:each in="${myList}" status="i" var="myVar">
// if the user performs some view action, update one of the myVar elements
</g:each>
This works, but I don't think it's quite threadsafe. myList is an http request variable but in cases of pages that use ajax (or other client side manipulations), it is possible for two threads to be modifying the same request scope variable The Spring AbstractController class provides a setSynchronizeOnSession method.
Does grails provide any equivalent functionality? If not, what's the best way to protect this non-threadsafe mutation?
thanks,
Jeff