Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread safety in spring web application

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

Im writting a web application using spring frame work where after successful login a dashboard is shown according to user's privilege. I have extended a abstract controller and code looks like this


in the success.jsp, all the district and department under his privileges are displayed. how can i make this thread safe as multiple users will be loging in at same time .
will there be problem with thread saftey when i use unsynchronized objects like httpsession and HashMap. Can any one guide me on this ?

Thanks & Regards
Anuja
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you believe it's not thread-safe?
 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i thought it is thread safe but my success page is displaying wrong values (values of other user) when mutiple users are logged in .This is also not happening always. i thought it could be some problem with thread safety as i have not synchronized my controller or jsp or any other beans
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then there's an issue somewhere else--nothing in the code you've shown uses anything but session or local values.

The only unknown in this code is the dashboardService call.
 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank yo for the response . DashboardService is also a singleton bean without instance variables. Im still poking around the issue.
iam using scriplet in jsp like this .



could this be a problem?

Anuja
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it's all request and sessions variables, right?

How about StringUtilClass?
 
anuja Kar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes all are request and session variables. do i need to synchronize this code ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic