• Post Reply Bookmark Topic Watch Topic
  • New Topic

Http session thread safe?

 
Rahul Allampallewar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is HttpSession thread safe?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the javadocs don't talk about it, you should assume that it's not. In most cases that's not a problem, though, since a session is associated to a user, and users don't generally make several simultaneous requests to a web app. But it's something to keep in mind.
 
adil qureshi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session is NOT thread safe only requests are..... you can get more information from K S --- S C W C D book........ and make sure its handled properly in your application...
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adil qureshi wrote:Session is NOT thread safe only requests are..... you can get more information from K S --- S C W C D book........ and make sure its handled properly in your application...
...

correct.. Session is not thread safe. But one more thing forgot as per SCWCD book request parameters and local variables are thread safe....
 
adil qureshi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah they are thread safe that's what i have written ( only request are ) ......
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As web pages get more and more complex, users client program can easily have multiple requests being processed "at the same time" and thus have multiple request Threads reading and/or modifying session data "simultaneously."

It is up to you the programmer to recognize possible conflicts.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!