aspose file tools*
The moose likes Struts and the fly likes Struts 2 action classes are not singleton 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 "Struts 2 action classes are not singleton" Watch "Struts 2 action classes are not singleton" New topic
Author

Struts 2 action classes are not singleton

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 action classes are not singleton
 
Similar Threads
[S2] Multiple files sent simulatneously with out.write() results in corrupted data streams
Mutiple instances of request handlers
several actions with same action class and only one instance
session in servers
Multiple instances of an Action class