Is Struts Action class Thread Safe?

Answer Posted / vijay

Struts 1 Actions are singletons and must be thread-safe
since there will only be one instance of a class to handle
all requests for that Action. The singleton strategy places
restrictions on what can be done with Struts 1 Actions and
requires extra care to develop. Action resources must be
thread-safe or synchronized.


Struts 2 Action objects are instantiated for each request,
so there are no thread-safety issues. (In practice, servlet
containers generate many throw-away objects per request, and
one more object does not impose a performance penalty or
impact garbage collection.)

Is This Answer Correct ?    53 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between plain-validator and field-validator in struts?

522


What are construction struts?

507


What are the life cycle methods of interceptor?

517


What is the use of token interceptor in Struts2?

616


Explain about the tag?

623






State an example of struts configuration file as an action parameter for action servlet.

535


What are different Struts2 tags? How can we use them?

569


What are action errors and error and what are the consequences they impose?

561


What's the purpose of execute method of action class?

526


Explain how can we upload files in struts2 application?

619


How many instances of servlet usually run in a struts application ?

538


What are the components of struts?

553


How can link tag’s action attribute be used?

521


What is the default suffix for struts2 action uri ?

550


what is meant by Struts Validator Framework?

561