aspose file tools*
The moose likes Servlets and the fly likes Struts:multiple threads modifying same method at same time in singleton ActionServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Struts:multiple threads modifying same method at same time in singleton ActionServlet" Watch "Struts:multiple threads modifying same method at same time in singleton ActionServlet" New topic
Author

Struts:multiple threads modifying same method at same time in singleton ActionServlet

sabuj paul
Greenhorn

Joined: Oct 29, 2003
Posts: 10
In struts framework , there is one ActionServlet which is singleton in nature and work on different user threads.Now suppose one thread change any method on action servlet and at the same time another thread accesing the same page trying to change the same method or same variable.So if number of threads trying to change the same method or variable at the same, wont there arise any problem bcos of this? Or pls tell how struts handle this situation.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

As long as the variables are local to the method you're safe. Each thread gets its own copy of those variables. It's mostly the instance variables you need to be wary of.
Dave
 
 
subject: Struts:multiple threads modifying same method at same time in singleton ActionServlet