If two copies of the same action is run at the same time parallelly (by ajax,
iframe, etc.) in the same session, possibly with different parameters, do
these actions call the same instance of an interceptor's intercept() method?
If this is the case, how to avoid problems that can arise?

For example,

there is an intercept method like

public String intercept(ActionInvocation actionInvocation) throws Exception
{
.....Do some pre work....
String result = actionInvocation.invoke();
.....Do some after work....
return result;                          
}

when the first copy of action is run, it does the pre work, then invoke() is
called, at this time action2 is run so it runs pre work, calls it's invoke()
then while doing after work, first action returns from invoke() thus
changing the value of result variable. So the result is now first action's
result and both actions return to the result from the first action, right?

is defining the intercept method as "synchronized" a solution?

thanks for the help.
-- 
View this message in context: 
http://www.nabble.com/Interceptor-%28Thread-Safety%29-tp23836386p23836386.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to