Multi-thread concurrency issue

During our concurrency testing, we observed NullPointer exceptions being
thrown when two people hit the same page at the same time for the first
time. Upon further investigation, it turns out that we need to synchronize
the init method on ASTDirective, ASTSetDirective, and render method on
ASTSetDirective, and VelocimacroProxy.

 Basically, the problem is introduced as the following; when two threads
attempts to parse and render the same template at the same time. Thread1
finishes parsing first and proceeds to the render method call, while thread
2 is still busy parsing and will overwrite the existing parse tree that is
being used by thread 1 for rendering purpose. Thus under certainly condition
a NullPointer exception will be thrown.

 I have run through all existing test cases successfully and the memory
saving has been verified by YourKit profiler.
http://www.nabble.com/file/7596/node-patch.txt patch.txt 
http://www.nabble.com/file/7593/VelocimacroProxy.java VelocimacroProxy.java 
http://www.nabble.com/file/7594/ASTSetDirective.java ASTSetDirective.java 
http://www.nabble.com/file/7595/ASTDirective.java ASTDirective.java 

Thanks.
-- Lei
-- 
View this message in context: 
http://www.nabble.com/Fixes-for-Multi-threaded-concurrency-issue-only--resubmitted-tf3497213.html#a9768199
Sent from the Velocity - Dev mailing list archive at Nabble.com.


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

Reply via email to