File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scenarios in which session attributes are not thread safe?

 
Rao Potla
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please give some suggestions for me how to send multiple requests at the same time to access session attributes in non thread safe manner,

Thanks in advance.
RaoPotla
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Click the button which sends a request to a servlet which uses session attributes. Then before that servlet sends its response, click the button again. Now you have two threads running the same servlet and using the same session.

To do this your servlet is going to have to run rather slowly, so that you have time to click the button twice.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also multiple Ajax requests, frames, iframe, and tabs in the same browser.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just look at how many requests go to make up a modern HTML page - each image, css, js, etc resource is loaded by a separate request, managed "simultaneously" by your browser, and thus "simultaneous" on the server side and each seeing the same session.

Bill
 
Rao Potla
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Click the button which sends a request to a servlet which uses session attributes. Then before that servlet sends its response, click the button again. Now you have two threads running the same servlet and using the same session.

To do this your servlet is going to have to run rather slowly, so that you have time to click the button twice.


thank you , its very helpful
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic