Author: jacopoc
Date: Sat Apr 21 12:19:31 2012
New Revision: 1328641
URL:
http://svn.apache.org/viewvc?rev=1328641&view=revLog:
Synchronized read access to the parsedScript cache to avoid issues with concurrent thread visibility.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1328641&r1=1328640&r2=1328641&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Sat Apr 21 12:19:31 2012
@@ -116,7 +116,10 @@ public class GroovyUtil {
}
public static Class<?> getScriptClassFromLocation(String location, GroovyClassLoader groovyClassLoader) throws GeneralException {
try {
- Class<?> scriptClass = parsedScripts.get(location);
+ Class<?> scriptClass = null;
+ synchronized (parsedScripts) {
+ scriptClass = parsedScripts.get(location);
+ }
if (scriptClass == null) {
URL scriptUrl = FlexibleLocation.resolveLocation(location);
if (scriptUrl == null) {
@@ -181,7 +184,10 @@ public class GroovyUtil {
public static Object runScriptFromClasspath(String script, Map<String,Object> context) throws GeneralException {
try {
- Class<?> scriptClass = parsedScripts.get(script);
+ Class<?> scriptClass = null;
+ synchronized (parsedScripts) {
+ parsedScripts.get(script);
+ }
if (scriptClass == null) {
scriptClass = loadClass(script);
synchronized (parsedScripts) {