Grails/Spring HttpServletRequest synchronization
Posted
by Jeff Storey
on Stack Overflow
See other posts from Stack Overflow
or by Jeff Storey
Published on 2010-05-03T11:12:22Z
Indexed on
2010/05/03
11:18 UTC
Read the original article
Hit count: 293
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
© Stack Overflow or respective owner