This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes Are struts action classes thread safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Are struts action classes thread safe?" Watch "Are struts action classes thread safe?" New topic
Author

Are struts action classes thread safe?

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,

Could any one justify why struts action classes are/aren't thread safe?

Thanks,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56521
    
  14

They're thread-safe if you write them to be so. Write them to not be thread-safe and they won't be.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26489
    
  78

Struts (1) action classes are not thread safe in that they are essentially singletons. Therefore non-thread safe classes and state should not be stored in instance variables.

If you don't maintain state, the classes are thread safe. (Which is what I think Bear was getting at.)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
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: Are struts action classes thread safe?
 
Similar Threads
Is Struts ThreadSafe
Convert struts' Action class into stateless session bean ?
Struts Thread safe
Struts 1.2 session problem
Is Struts Action class Thread Safe?