DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7361>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7361

Performance Enhancement to MessageResouce.getMessage(..)

           Summary: Performance Enhancement to MessageResouce.getMessage(..)
           Product: Struts
           Version: 1.1 Beta 1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Standard Actions
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


the following snippet is much faster then the internal caching.

because there is no key to build up and only 1 Object will be created 
instead of 4. 

it is about 4 times faster (meassured with JProbe profiler).


... extends MessageResources
{

    public String getMessage(Locale locale, String key)
    {
        HashMap messageMap = (HashMap)messageLocaleMaps.get(locale);
        if (messageMap == null)
        {
            messageMap = new HashMap();
            messageLocaleMaps.put(locale, messageMap);
        }
        String message = (String)messageMap.get(key);
        if (message == null)
        {
            message = super.getMessage(locale, key);
            messageMap.put(key, message);
        }
        return message;
    }

}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to