This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 action classes are not singleton

 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 2 action classes are not singleton

1)it will create new instance for each tread(each request eventhough from the same session)
2) It will create a instance for a session, consecutive threads from the session use the same instance
3) Since It create a new instance ,I do not worry about multithreading ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)it will create new instance for each tread(each request eventhough from the same session)
2) It will create a instance for a session, consecutive threads from the session use the same instance

Are you asking which one of those Struts 2 does? Every request instantiates a new action.
3) Since It create a new instance ,I do not worry about multithreading ?

In general, that's correct, as long as your actions don't have any un-synchronized static properties.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic