What happens when Two users requests for same action class?
How the threads are controlled?

Answers were Sorted based on User's Feedback



What happens when Two users requests for same action class? How the threads are controlled?..

Answer / joydeep

here 2 users will get 2 different instance of the action
class. each one will behave in their way as said in
configuration file.

Is This Answer Correct ?    20 Yes 4 No

What happens when Two users requests for same action class? How the threads are controlled?..

Answer / rk

I do not see a single correct answer.

In Struts1, Action resources must be thread-safe or
synchronized. So Actions are singletons and thread-safe,
there should 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 Struts1 Actions and
requires extra care to develop.

However in case of 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.)

reference:
http://www.javabeat.net/qna/690-struts-1x-vs-struts-20/

Is This Answer Correct ?    10 Yes 0 No

What happens when Two users requests for same action class? How the threads are controlled?..

Answer / rajshekhar

In this case both the users will get saparate instanceses
of the same action class.and both will work independintely.

Is This Answer Correct ?    7 Yes 4 No

What happens when Two users requests for same action class? How the threads are controlled?..

Answer / anjani kumar jha

For every request........crossponding instance is
created.....
Means n no of rquest=n no of instance.......
And for every instance one thread is allocated for
that......and then......somtimes may chances of deadlock...

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Struts Interview Questions

List the important attribute and elements of action mapping under struts.

0 Answers  


Which library is provided by struts for form elements like check boxes, text boxes etc?

0 Answers  


Which tag is used to declare constants in struts xml?

0 Answers  


how to create a search field in struts.with code

3 Answers   Infosys, Satyam,


What are the reasons for an error message not being displayed while developing struts application?

0 Answers  






What are pull and push mvc architecture and which architecture does struts2 follow?

0 Answers  


how can i fetch combo box value into my DAO using struts 2?

3 Answers  


Does Struts2 action and interceptors are thread safe?

0 Answers  


what is the difference between page and pageContext implicit variables

2 Answers   Yash Technologies,


How nested beans can be used in Struts applications?

0 Answers  


How to display validation errors on jsp page?

0 Answers  


Explain about struts?

0 Answers  


Categories