[
https://issues.apache.org/jira/browse/WW-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15038864#comment-15038864
]
zhouyanming commented on WW-4575:
---------------------------------
{code:java}
public static ResourceBundle findResourceBundle(String aBundleName, Locale
locale) {
ResourceBundle bundle = null;
ClassLoader classLoader = getCurrentThreadContextClassLoader();
String key = createMissesKey(String.valueOf(classLoader.hashCode()),
aBundleName, locale);
try {
if (!bundlesMap.containsKey(key)) {
bundle = ResourceBundle.getBundle(aBundleName, locale,
classLoader);
bundlesMap.putIfAbsent(key, bundle);
} else {
bundle = bundlesMap.get(key);
}
} catch (MissingResourceException ex) {
if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) {
try {
if (!bundlesMap.containsKey(key)) {
bundle = ResourceBundle.getBundle(aBundleName, locale,
delegatedClassLoaderMap.get(classLoader.hashCode()));
bundlesMap.putIfAbsent(key, bundle);
} else {
bundle = bundlesMap.get(key);
}
} catch (MissingResourceException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Missing resource bundle [#0]!", aBundleName);
}
}
}
}
return bundle;
}
{code}
ResourceBundle.getBundle(aBundleName, locale, classLoader) get called every
time, bundlesMap.putIfAbsent(key, bundle) never called, You should put an
EmptyResourceBundle in catch (MissingResourceException ex).
> Fix performance regression
> --------------------------
>
> Key: WW-4575
> URL: https://issues.apache.org/jira/browse/WW-4575
> Project: Struts 2
> Issue Type: Task
> Affects Versions: 2.3.20, 2.3.24
> Reporter: zhouyanming
>
> I have an application run with struts2, recently I found my application
> performance downgraded if struts2 upgraded. a special use case:
> ab -n 3000 -c 150 http://localhost/login
> ||requests/second||struts2 version||
> |684|2.3.16|
> |515|2.3.18|
> |312|2.3.24|
> It's appreciatory if someon test with official example.
> I think struts2 should focus on performance improvement, make struts2 more
> configurable to deal with performance and security trade-off.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)