wood burning stoves
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is Action class thread safe" Watch "Is Action class thread safe" New topic

Is Action class thread safe

Prakash Kumar M

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: 255

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.

Salil Verma
I agree. Here's the link: http://aspose.com/file-tools
subject: Is Action class thread safe
jQuery in Action, 3rd edition