You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Puneet Babbar 2 <pb...@sapient.com> on 2012/05/04 07:48:41 UTC

ActionContext and the application context

Hi,

I have slight confusion in understanding of the thread locality of the ActionContext. And action context contains the application, session, request... etc

Talking about general servlet/jsp programming, anything set in the application context can be shared between different sessions or users.

So since ActionContext is thread local(which means that values stored in the ActionContext are unique per thread).
So, what is the impact on application context? Since its accessed using ActionContext.

Regards

Puneet babbar


Re: ActionContext and the application context

Posted by Dionis Argiri <di...@gmail.com>.
Good starting point would be reading code of action context etc, it could
give you some answers that are not mentioned in any
faq/tutorial/documentation. Simplified answer is - struts2 actions are
thread safe (but that doesn't means that if you inject some statefull
service in your bean, it'll be automatically thread safe). Reading source
code & debugging gave me the answer about session's internal
synchronization - SessionMap returned, that is thread safe wrapper around
non-thread safe HttpSession.

2012/5/4 vEnkaTa mohAna rAo SriperumbUdUru <mo...@gmail.com>

> Go through this link
>
> http://stackoverflow.com/questions/10296108/struts2-actioncontext-and-valuestack
>
>
> On Fri, May 4, 2012 at 11:18 AM, Puneet Babbar 2 <pbabbar2@sapient.com
> >wrote:
>
> > Hi,
> >
> > I have slight confusion in understanding of the thread locality of the
> > ActionContext. And action context contains the application, session,
> > request... etc
> >
> > Talking about general servlet/jsp programming, anything set in the
> > application context can be shared between different sessions or users.
> >
> > So since ActionContext is thread local(which means that values stored in
> > the ActionContext are unique per thread).
> > So, what is the impact on application context? Since its accessed using
> > ActionContext.
> >
> > Regards
> >
> > Puneet babbar
> >
> >
>

Re: ActionContext and the application context

Posted by vEnkaTa mohAna rAo SriperumbUdUru <mo...@gmail.com>.
Go through this link
http://stackoverflow.com/questions/10296108/struts2-actioncontext-and-valuestack


On Fri, May 4, 2012 at 11:18 AM, Puneet Babbar 2 <pb...@sapient.com>wrote:

> Hi,
>
> I have slight confusion in understanding of the thread locality of the
> ActionContext. And action context contains the application, session,
> request... etc
>
> Talking about general servlet/jsp programming, anything set in the
> application context can be shared between different sessions or users.
>
> So since ActionContext is thread local(which means that values stored in
> the ActionContext are unique per thread).
> So, what is the impact on application context? Since its accessed using
> ActionContext.
>
> Regards
>
> Puneet babbar
>
>