File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Caching Struts Action Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Caching Struts Action Classes" Watch "Caching Struts Action Classes" New topic
Author

Caching Struts Action Classes

Deepika Saxena
Ranch Hand

Joined: Jul 05, 2009
Posts: 59
Hi,
As Struts Action classes are Not Thread Safe, in order to make them thread safety, they will be catched , once they are created and then onwards no more Action class instances would be created.
Please correct me if i am worng and please let me know how does this catching happens? i mean whether server will catch them or Struts itself has a built in mechanism to do it?
Thanks.
--Deepika
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's not really caching, it's just that only one is created.

Thread safety has to do with instance variables: since there's only one instance created, actions should either (a) avoid instance variables, and/or (b) make sure that instance variable access is made thread-safe through whatever mechanism.
 
wood burning stoves
 
subject: Caching Struts Action Classes
 
Similar Threads
accessing request scope attribute
Is Struts Action class SingleTon?
accessing request scope attribute
How to SET and GET session objects in Struts Action classes ???
Convert struts' Action class into stateless session bean ?