struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
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 
>most
>Struts users (not developers) at this point are probably more familiar with 
>the
>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 
>most
>users and avoid the issues surrounding thread safety which, if in practice 
>are
>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.

David


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message