Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Safe - Struts

 
Akhil Chauhan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Struts1 Action classes are not thread safe & instantiated only once.
So each request will access the same object.

Small Doubt -
If every request acess the same object.
What about the object inside the action classs, they will b instantiated per request or even they will behave same as Action class.
Ex -
ActionClass
{
List lst = new ArrayList();
}

Here -
ArrayList object wil be instantiated per request ?


 
Joe Ess
Bartender
Posts: 9319
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you have above has a variable in instance scope. There is one instance of that variable created for each instance of ActionClass, not for each request.
Have a look at the Action Class Design Guidelines
 
Akhil Chauhan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Joe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic