Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Thread safety in spring web application

 
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
 
Author
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
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
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 ?
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!