In my web application. One page is dynamically loaded with ajax call. When Single user is logged into the system the page is rendered properly. but multiple user sessions behave abnormally. Sometimes value rendered by ajax is from other user session. Can any one tell me what could be causing this problem . Any help will be appreciated.
Thanks in advance
Sounds like what you get when your code has instance variables holding user specific information.
Remember one instance of your jsp/servlet code may handle many many requests "at the same time." User specific information must be stored where only one request can see it.
Joined: Jun 15, 2010
Thank you for the response. But my problem is not regarding user specific information . I have three combo box to choose from
each combo sends an ajax request and fill the next combo . On the last combo change im displaying a table . When i am testing it from the development machine it is working fine. But a when around 20 users use the page at same time. The response for the first person sometimes displayed i the third persons browser(which is wrong according to the values he selected) and first person is not getting any response from server. I am not sure why this happens . is it because the page fires more ajax request than the browser allow ? or server is swamped with ajax requests . Can any one guide me regarding this ?
What Bill is getting at is that the server-side code needs to be written in a thread-safe manner, so that simultaneous accesses don't clobber each other's data. Specifically, shared mutable state needs to be protected - instance variables in a servlet are one such case, as are context attributes.
Author and all-around good cowpoke
Joined: Mar 22, 2000
But my problem is not regarding user specific information .
But what is the following if not user specific information??
The response for the first person sometimes displayed i the third persons browser(which is wrong according to the values he selected)
Joined: Jun 15, 2010
Thanks bill & ulf for clarification. I was confused about the user specific bit. Can you please suggest how ajax call can be made thread safe.