You have to "respond" to both requests.  If you can detect this sort of
thing
happening by adding a "busy" attribute to the session when you get a request
and
then removing it when you're done (and, correspondingly, looking to see if
such
an attribute exists before processing a request), you could get away with
sending
a canned "already busy processing your request" response to the second (and
subsequent)
request.

There's no good solution on the server side, as you see.  Most people try to
prevent this
on the client side through JavaScript.

Duane Morse, Eldorado Computing Inc., Phoenix, Arizona


-----Original Message-----
From: Jay Walters [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 11:54 AM
To: [EMAIL PROTECTED]
Subject: Avoiding multiple concurrent requests from same client


I am concerned about a problem and I am sure others have either solved it,
or figured it really isn't a problem for one reason or another.

I have a set of servlets that make use of HttpSession during their
processing.  If a single client presses a button on their form twice they
will send two requests to the app server at the same time. Does this cause a
race condition in which servlet thread 2 might write to the HttpSession and
then thread 1, but thread 2 returns the page to the browser so now the data
in HttpSession isn't quite correct (it's the result from thread 1 not thread
2).

The servlet spec seems to say it's up to the developer to cope with this
problem - I need to make sure that the page the user is looking at
corresponds to the state of their session in the app server.

Is this really a problem?  Is there a simple or well known way to cope with
this?

Cheers

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to