Author: henning
Date: Sat Nov  4 11:06:59 2006
New Revision: 471246

URL: http://svn.apache.org/viewvc?view=rev&rev=471246
Log:
Serialize the resource retrieval per engine to avoid racing
when parsing the template (one thread parses the template,
another is reloading it). This showed prominently when running
a load benchmark on VelocityViewServlet with caching off.

Turning caching on hides the problem. But only synchronizing
the getResource method really fixes it. This slows applications
down visibly that don't run with template caching and and reload
a number of templates again and again. 

Fixes VELOCITY-24. Should be revisited for Velocity-2.0

Modified:
    
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?view=diff&rev=471246&r1=471245&r2=471246
==============================================================================
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 Sat Nov  4 11:06:59 2006
@@ -284,7 +284,7 @@
      *          to syntax (or other) error.
      * @throws Exception if a problem in parse
      */
-    public Resource getResource(String resourceName, int resourceType, String 
encoding )
+    public synchronized Resource getResource(String resourceName, int 
resourceType, String encoding )
         throws ResourceNotFoundException, ParseErrorException, Exception
     {
         /*



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

Reply via email to