struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <>
Subject Re: why only one instance of Action class (Action class thread safety)
Date Mon, 05 May 2003 17:19:16 GMT
>Indeed, the multi-threaded use of Actions is much like the Servlet API, but 
>Struts users (not developers) at this point are probably more familiar with 
>JSP APIs than with working directly with "pure" Servlet apps.
>Why not use the lifecycle model of a JSP tag for Actions?

Because this is much more difficult to understand than how Struts currently 
is.  Look at the number of bugs reported against custom tags that deal with 
lifecycle issues for proof.

>Pool them for
>performance (if it's even worth the trouble), include a reset/cleanup 
>method to
>be called by the framework, and guarantee single-threaded access within the
>scope of a request.

IMO, this is not worth the trouble.  Singleton Actions are fast, easy to 
code, and easy for the Struts team to maintain the implementation.

>It would be an equally familiar and easy to explain by analogy model for 
>users and avoid the issues surrounding thread safety which, if in practice 
>not actually so complicated, many find intimidating and unintuitive.

Coding Struts Actions should be done by programmers.  Java programmers 
should know (or at least be willing to learn) threading rules.  It's 
extremely simple to explain to people that they shouldn't use instance 
variables in their actions.


MSN 8 with e-mail virus protection service: 2 months FREE*

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message