Even then the solution is very limited. The OP probably wants to cache all
popular pages/reports, in many cases the same action will be responsible...
a singleton clearly can't address that.

It could be addressed with an object pool that was keyed to actions,
parameters and values and managed by an interceptor. I think it would be
tricky to implement, particularly the promotion of which resources to the
cache and which objects to dispose of.


On Wed, Feb 13, 2013 at 2:22 AM, Antonios Gkogkakis <gkogk...@tcd.ie> wrote:

> On 13 February 2013 07:35, Lukasz Lenart <lukaszlen...@apache.org> wrote:
>
> > 2013/2/12 Antonios Gkogkakis <gkogk...@tcd.ie>:
> > > Assuming that caching of Action objects makes sense in your
> application,
> > > you could change the struts default object factory,
> > > to guice or spring and declare the  action beans that you want to be
> > cached
> > > as singletons. Alternatively you could write your own object factory
> and
> > > put some caching logic there.
> >
> > It isn't a good practise to declare actions as singleton, Struts 2
> > wasn't designed in that way. You really must know what are you doing
> > :-)
> >
> > I'm with you on that one Lukasz that's way I said "assuming..." :)
> >
>
> Antonios
>

Reply via email to