Hi Matt,
Don has asked me to post the following:

We've been doing some performance testing and have found a neat little
race condition with the SpringAction.

Symptom:

During high load we saw NPE's in the system log coming from actions
invoked by the SpringAction. After a code review, we found that these
were due to a null ActionServlet being present in the action. This was
rather funny since the SpringAction provides the ActionServlet instance
to each action it invokes. BUT it also clears the action in a finally
block --> that's the problem.

Solution:

1. Don't configure actions as singletons in Spring. This is the obvious
solution, but not really a nice one, seeing as Actions are singletons in
Struts, so why should it be any different in Spring. 

2. Stop clearing the ActionServlet in the finally block of SpringAction.
This is preferred, but since clearing the action is actually s Struts
lifecycle event (i.e. it tells the action to cleanup its resources), it
may still be required. This is where we put a little Spring-specific
code into each action that needs resource cleanup --> each such action
should implement org.springframework.beans.factory.DisposableBean so
that it can cleanup when Spring tells it, rather than when Struts (or
the SpringAction) does. Its actually appropriate for this, since we are
using Spring-configured Struts actions, so why not have Spring control
their destruction as well.

Tom.


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Struts-apps mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/struts-apps

Reply via email to