• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caching Struts Action Classes

 
Deepika Saxena
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic