Hi all,
Recently I've noticed a high cpu load on my machine. The problem was a
thread caught in the while loop from the HashMap class.
Here is the stacktrace:
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(Unknown Source)
at
org.apache.velocity.util.introspection.ClassMap$MethodCache.get(ClassMap
.java:249)
at
org.apache.velocity.util.introspection.ClassMap.findMethod(ClassMap.java
:102)
at
org.apache.velocity.util.introspection.IntrospectorBase.getMethod(Intros
pectorBase.java:105)
at
org.apache.velocity.util.introspection.Introspector.getMethod(Introspect
or.java:94)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.discover(Proper
tyExecutor.java:99)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.<init>(Property
Executor.java:56)
at
org.apache.velocity.util.introspection.UberspectImpl.getPropertyGet(Uber
spectImpl.java:246)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentif
ier.java:148)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReferenc
e.java:252)
at
org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReferen
ce.java:460)
at
org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpres
sion.java:62)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfState
ment.java:85)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.jav
a:336)
at
org.apache.velocity.runtime.directive.Parse.render(Parse.java:260)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective
.java:175)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.jav
a:336)
at
org.apache.velocity.runtime.directive.Parse.render(Parse.java:260)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective
.java:175)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.jav
a:336)
at org.apache.velocity.Template.merge(Template.java:328)
It seems that the reason is concurrent access to the get and put methods
of HashMap which are not synchronized. Is this the problem?
Best Regards,
Johann