Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Is Struts Action class Thread Safe?

Answers were Sorted based on User's Feedback



Is Struts Action class Thread Safe?..

Answer / 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

Is Struts Action class Thread Safe?..

Answer / shakthi kumar

Action class is not thread safe, multiple threads will be
created for multiple requests to execute method, there is
no point in creating instance for each request. Also,
Action class is not a servlet, it just acts as an
intermediate between your business delegator (Action
Servlet) and your business layer only if designed properly.

Is This Answer Correct ?    22 Yes 6 No

Is Struts Action class Thread Safe?..

Answer / guddu

I think Struts Action class is not Thread Safe
For more of these, please visit
http://freesourceutilityhelp.googlepages.com
http://question2answer.googlepages.com
http://context2designpatterns.googlepages.com

Thanks

Is This Answer Correct ?    23 Yes 9 No

Is Struts Action class Thread Safe?..

Answer / styphy

In Struts-1x there will be only one instance of action
class. Hence it is not thread safe and the programmer has to
make sure that the code is thread safe.

In Struts 2x 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 ?    14 Yes 2 No

Is Struts Action class Thread Safe?..

Answer / bhanu prakash

It depends upon the usability, Struts action is a thread
safe if you are not using any Instance variable.

If you are using instance variable then it is not thread
safe.In this case you need to take extra precaution to
ensure the desired behaviour .( synchronization etc).

Is This Answer Correct ?    7 Yes 4 No

Is Struts Action class Thread Safe?..

Answer / shrikant kale

Basically ,ApplicationContoller/RequestProcessor will
create & use the only instance of each Action class [hence:
Singleton in nature] .

Also, it is not Thread-Safe as it suppose to serve the
multiple request.

Hence we must not declare class instance variable in Action
class.If declared so then Action class state becomes non-
thread safe.

Is This Answer Correct ?    2 Yes 0 No

Is Struts Action class Thread Safe?..

Answer / tipu swain

No Action classes are not Thread safe by default. But the Code written in the server or inside Struts software makes Action class as Thread safe and Singleton also..

Is This Answer Correct ?    2 Yes 1 No

Is Struts Action class Thread Safe?..

Answer / shrikant kale

ApplicationContoller/RequestProcessor will create & use the
only instance of each Action class [hence: Singleton in
nature] .

Also the Action class has to handle the multiple request
(most of time simultaniously.) so it cant be Thread-Safe.


Hence we must not declare class instance variable in Action
class.If declared so then Action class state becomes non-
thread safe.

Is This Answer Correct ?    1 Yes 0 No

Is Struts Action class Thread Safe?..

Answer / new user

Useful information about struts 1.x and struts 2
comparision:
http://struts.apache.org/2.0.14/docs/comparing-struts-1-and-
2.html

Is This Answer Correct ?    2 Yes 2 No

Is Struts Action class Thread Safe?..

Answer / ugandhar

Struts1 is not Thread Safe.
Struts2 is thread safe.

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More Struts Interview Questions

project architechture in java

3 Answers   AC, IBM, INDUS, Satyam,


How is declarative handling of exceptions done in struts ?

0 Answers  


Can you call Action class methods from Struts config.xml?

1 Answers   iGate,


Lists the bundled validators in struts?

0 Answers  


What are the core components of a struct2 based application?

0 Answers  


How do you convert struts to springs?

0 Answers  


What are the life cycle methods of interceptor?

0 Answers  


what are java stuts? what are there uses

2 Answers   Rupa, Tech Mahindra,


How you will make available any message resources definitions file to the struts framework environment?

0 Answers  


What is struts xml?

0 Answers  


What is the use of forwardaction?

0 Answers  


Which servlet does the struts framework use?

0 Answers  


Categories