Author: jonesde
Date: Wed Sep 26 03:34:26 2007
New Revision: 579571
URL:
http://svn.apache.org/viewvc?rev=579571&view=revLog:
Cleaned up how sync is done for cache in renderTemplateFromString, based on comments from Adrian Crum in Jira OFBIZ-1258
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=579571&r1=579570&r2=579571&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java Wed Sep 26 03:34:26 2007
@@ -164,15 +164,15 @@
if (template == null) {
synchronized (cachedTemplates) {
template = (Template) cachedTemplates.get(templateLocation);
+ if (template == null) {
+ Reader templateReader = new StringReader(templateString);
+ template = new Template(templateLocation, templateReader, getDefaultOfbizConfig());
+ templateReader.close();
+ cachedTemplates.put(templateLocation, template);
+ }
}
}
- if (template == null) {
- Reader templateReader =new StringReader(templateString);
- template = new Template(templateLocation, templateReader, getDefaultOfbizConfig());
- templateReader.close();
- cachedTemplates.put(templateLocation, template);
- }
renderTemplate(template, context, outWriter);
}