File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Thread safety in spring web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Thread safety in spring web application" Watch "Thread safety in spring web application" New topic
Author

Thread safety in spring web application

anuja Kar
Greenhorn

Joined: Jun 15, 2010
Posts: 9
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

Joined: Sep 29, 2008
Posts: 12617

What makes you believe it's not thread-safe?
anuja Kar
Greenhorn

Joined: Jun 15, 2010
Posts: 9
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jun 15, 2010
Posts: 9
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

Joined: Sep 29, 2008
Posts: 12617

Well, it's all request and sessions variables, right?

How about StringUtilClass?
anuja Kar
Greenhorn

Joined: Jun 15, 2010
Posts: 9
yes all are request and session variables. do i need to synchronize this code ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread safety in spring web application