Author: jacopoc
Date: Sat Apr 21 12:20:16 2012
New Revision: 1328642
URL:
http://svn.apache.org/viewvc?rev=1328642&view=revLog:
Backported rev. 1328641: Synchronized read access to the parsedScript cache to avoid issues with concurrent thread visibility.
Modified:
ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
Modified: ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1328642&r1=1328641&r2=1328642&view=diff==============================================================================
--- ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original)
+++ ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Sat Apr 21 12:20:16 2012
@@ -102,7 +102,10 @@ public class GroovyUtil {
public static Class<?> getScriptClassFromLocation(String location) 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) {
@@ -149,7 +152,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) {