Hi ,

I seem to have run into a problem with the HttpSession object and
multithreaded behaviour.

I am storing a variable in the session object which I need to retrieve for
the next call from the user. Now when I test the servlet using two
simultaneous calls I find the value is getting overwritten by the thread
leaving the servlet last instead of the thread modifying the value of the
session variable

The simultaneous calls are from the same session i.e I click on the submit
button twice in quick succession .

scenario :

1)  Thread A enters the servlet's doGet() Method and modifies a session
variable

2) Later,Thread B enters the servlet's doGet() Method and modifies the same
session variable.


3) Thread B leaves the servlet first .

4) Thread A exits the servlet next.

5) Now the session variable value reflects the change made by Thread A
whereas it should have shown the
     value modified by Thread B.


Is this a valid behaviour and if yes is there anyway to save the value set
by Thread B.

Thanks,
Arijith

___________________________________________________________________________
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