Re: Struts2 String ThreadSafe?

2012-11-29 Thread Umesh Awasthi
I believe you should look more in to more spring doc to see how spring provide instance based on the scope provided for the bean. Struts2-Spring integration is only providing bridge where in place of struts internal DI, Spring is handling DI for you but rest of the flow and concepts will be same

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Chris Pratt
It's not a chance, the same instance is being used for all requests to that action. (*Chris*) On Thu, Nov 29, 2012 at 7:42 AM, Rohit Gupta wrote: > So given the fact that my beans are not prototype, there is a chance that > the same action class may be used for two consecutive requests. > > R

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Rohit Gupta
So given the fact that my beans are not prototype, there is a chance that the same action class may be used for two consecutive requests. Regards, On 29/11/12 9:02 PM, "Umesh Awasthi" wrote: >First and foremost for using spring with Struts2 make your action bean >scope prototype >and is not be

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Dave Newton
On Thu, Nov 29, 2012 at 2:01 PM, Eric Reed wrote: > Using "global / instance" variables is a bad coding practice you should kick > now and should be avoided unless you are defining something final static > such as a log file. Just to be clear: the entire S2 framework is predicated on instance v

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Eric Reed
This was a problem with Struts 1.3 which reuses action classes. On a large project I took over the only real solution was to open up the Struts 1.3 source and re-code it because the app was too big to replace all the instance variables. Using "global / instance" variables is a bad coding practi

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Dave Newton
Correct: if an action isn't instantiated per-request, obviously instance variables will be shared across requests. Dave On Thu, Nov 29, 2012 at 10:51 AM, rohit wrote: > So in the current case there is a chance that same action class may be used > in simultaneous request and hence the mixup? > >

Re: Struts2 String ThreadSafe?

2012-11-29 Thread rohit
So in the current case there is a chance that same action class may be used in simultaneous request and hence the mixup? On Thu, 29 Nov 2012 21:02:23 +0530 Umesh Awasthi wrote First and foremost for using spring with Struts2 make your action bean scope pr

Re: Struts2 String ThreadSafe?

2012-11-29 Thread Umesh Awasthi
First and foremost for using spring with Struts2 make your action bean scope prototype and is not be ready for the weird issues Struts2 itself create a new request instance as well other objects associated with itself to make it thread safe. On Thu, Nov 29, 2012 at 8:59 PM, rohit wrote: > Hi

Struts2 String ThreadSafe?

2012-11-29 Thread rohit
Hi, We are using Struts2-Spring integration and all my action classes implement SessionAware, sample code to action class and their spring definition is given below, public class IRXxxxAction extends ActionSupport implements SessionAware { private Map session; public String execute() {//} p