File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Action class thread safe

 
Prakash Kumar M
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 255
Hibernate Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic