• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple user Ajax problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You don't like waffles? Well, do you like this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic