wood burning stoves 2.0*
The moose likes Struts and the fly likes Is Action class thread safe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is Action class thread safe" Watch "Is Action class thread safe" New topic
Author

Is Action class thread safe

Prakash Kumar M
Greenhorn

Joined: Jun 29, 2009
Posts: 18

Recently i had an interview, where i faced a question as


In Action,ActionForm,ActionServlet,ActionMapping classes which are thread safe and why


Can you please let me know the correct answers. I was confused.

Thanks in advance
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 253

Action is not thread safe as only one instance of an action object is created and all the requests access it.

ActionForm itself is not thread safe reason being when it is stored as an attribute in session, multiple requests can manipulate its values.

ActionServlet is a servlet which is not thread safe.

ActionMapping object should be thread safe, reason being it is initialized only at the time of struts-configuration initialization (at the load time of ActionServlet). After that the configuration is frozen.

Regards
Salil Verma
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is Action class thread safe
 
Similar Threads
Thread-safe Action class ?
why request is thread safe
question about action class
ActionServlet Thread Safe
Is Struts Action class Thread Safe?