Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.1.0
-
None
Description
I am seeing high CPU utilization on AbstractModelBody.evaluateAsString method in my thread dumps.
java.lang.Thread.State: RUNNABLE
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
at java.util.regex.Pattern$Curly.match0(Pattern.java:4158)
at java.util.regex.Pattern$Curly.match(Pattern.java:4132)
at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
at java.util.regex.Pattern$Start.match(Pattern.java:3408)
at java.util.regex.Matcher.search(Matcher.java:1199)
at java.util.regex.Matcher.find(Matcher.java:592)
at org.apache.tiles.autotag.core.runtime.AbstractModelBody.evaluateAsString(AbstractModelBody.java:70)
at org.apache.tiles.template.PutAttributeModel.execute(PutAttributeModel.java:96)
at org.apache.tiles.jsp.taglib.PutAttributeTag.doTag(PutAttributeTag.java:226)
What I did
1. Declared a compiled Pattern
private static Pattern pattern = Pattern.compile("^\\s*|
s*$");
2. in evaluateAsString :
pattern.matcher(body).replaceAll("");