You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manos Batsis <ma...@geekologue.com> on 2008/01/15 16:02:23 UTC

Re: How do I prevent two calls concurrently?

Givler, Eric wrote:
> The problem is the
> user double clicks [login] and can get two calls to the service method
> to execute simultaneously.  They both don't see a row, so they both do
> an INSERT.  One of the inserts fails due to a PK on the username.  



See generateToken[1] and isTokenValid [2]. The token will be valid for 
only one request. What to do with the invalid request (also the latest) 
is up to you.

[1] 
http://struts.apache.org/1.x/apidocs/org/apache/struts/action/Action.html#generateToken(javax.servlet.http.HttpServletRequest)
[2] 
http://struts.apache.org/1.x/apidocs/org/apache/struts/action/Action.html#isTokenValid(javax.servlet.http.HttpServletRequest)

Cheers,

Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org