You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Musachy Barroso <mu...@gmail.com> on 2009/07/22 02:56:57 UTC

synchronized code in DefaultActionInvocation

This code in DefaultActionInvocation.createResult:

ActionConfig config = proxy.getConfig();
Map<String, ResultConfig> results = config.getResults();

ResultConfig resultConfig = null;

 synchronized (config) {
            try {
                resultConfig = results.get(resultCode);
            } catch (NullPointerException e) {
                // swallow
            }
            if (resultConfig == null) {
                // If no result is found for the given resultCode, try
to get a wildcard '*' match.
                resultConfig = results.get("*");
            }
        }

I can't see why wee need to synchronize that block...any ideas?

musachy
-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: synchronized code in DefaultActionInvocation

Posted by Wes Wannemacher <we...@wantii.com>.
I vaguely remember a while back an attempt to make packages, etc. reloadable. 
This was before we created an OSGi plugin, so it might not be relevant any 
more. 

IMO, between the OSGi plugin and the new spring enhancements you added, there 
is probably no need to worry about being able to reload the container. In 
fact, if we have tweaks like this, meant to support the ability to reload 
configuration, that slow the framework down, we should probably get rid of 
them.

-Wes

On Tuesday 21 July 2009 08:56:57 pm Musachy Barroso wrote:
> This code in DefaultActionInvocation.createResult:
>
> ActionConfig config = proxy.getConfig();
> Map<String, ResultConfig> results = config.getResults();
>
> ResultConfig resultConfig = null;
>
>  synchronized (config) {
>             try {
>                 resultConfig = results.get(resultCode);
>             } catch (NullPointerException e) {
>                 // swallow
>             }
>             if (resultConfig == null) {
>                 // If no result is found for the given resultCode, try
> to get a wildcard '*' match.
>                 resultConfig = results.get("*");
>             }
>         }
>
> I can't see why wee need to synchronize that block...any ideas?
>
> musachy

-- 
Wes Wannemacher
Author - Struts 2 In Practice 
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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