• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple user Ajax problem

 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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 ?

Thanks & Regards
Anuja

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)


Bill
 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
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.

Regards,
Anuja
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic