Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.0.1-core
-
None
-
WebSphere, IBM JRE.
Description
We have a webapp with SWF 2.3.0, JSF 2.1 and Trinidad 2.0.1 and have done performance tests in an environment with WebSphere and IBM JRE. When we reached a number of concurrent users of around 80 we get hot spots in calls of Class.getMethod. The stack trace contains following Trinidad method which perform this call often:
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TreeRenderer.getNodeType(UIXHierarchy)
Inspecting the source of this method I detected that it calls rowClass.getMethod("getNodeType") every time it's called - without caching the method handles reached in previous calls.
After doing a quick fix for this by caching the method handles we have solved this hot spot:
private final Map<Class<?>, Method> getNodeTypeMethodMap = new HashMap<Class<?>, Method>();
private Method retrieveGetNodeTypeMethod(Class rowClass) {
try {
synchronized (getNodeTypeMethodMap) {
if (getNodeTypeMethodMap.containsKey(rowClass))
Method getNodeTypeMethod = rowClass.getMethod("getNodeType");
getNodeTypeMethodMap.put(rowClass, getNodeTypeMethod);
return getNodeTypeMethod;
}
} catch (Exception e)
}
Could you please fix this for the next Trinidad release?