Previous posts have referred to using the token methods of Action to detect
duplicate requests (from the user clicking more than once without waiting
for a new page). For an example, see
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg02368.html.
Are there thread safety issues with this?
The description says to put this at the bottom of the action that leads to
the page being displayed:
saveToken(request);
And, put this near the top of the action that handles the page submission:
if (!isTokenValid(request)) {
... deal with the error ...
}
resetToken(request);
Should this latter section be synchronized so that two racing threads from
two nearly simultaneous submits from the same user don't both get past the
test before the token is reset?
Help me understand. Am I ...
- overly anal, since such a race is practically impossible?
or
- unaware of thread-simplification qualities of Struts?
or
- under-educated about how the Struts token capability handles this for us?
Thanks,
Steve