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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts:multiple threads modifying same method at same time in singleton ActionServlet
 
Similar Threads
is Action Servlet is designed as a Singleton class ?why?
database connections in threaded app
Reflections on singleton and synchronized methods
Threads Problem-2
The method in a singleton class