Author: lektran
Date: Fri Aug  2 03:18:17 2013
New Revision: 1509523

URL: http://svn.apache.org/r1509523
Log:
Merged from trunk r1509510:
Fix bug preventing deadlock retries for groovy services, GenericEngine 
implementations and services should never modify the service context

Modified:
    
ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java

Modified: 
ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=1509523&r1=1509522&r2=1509523&view=diff
==============================================================================
--- 
ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
 (original)
+++ 
ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
 Fri Aug  2 03:18:17 2013
@@ -99,19 +99,22 @@ public final class GroovyEngine extends 
         }
         Map<String, Object> params = FastMap.newInstance();
         params.putAll(context);
-        context.put(ScriptUtil.PARAMETERS_KEY, params);
+
+        Map<String, Object> gContext = FastMap.newInstance();
+        gContext.putAll(context);
+        gContext.put(ScriptUtil.PARAMETERS_KEY, params);
 
         DispatchContext dctx = dispatcher.getLocalContext(localName);
-        context.put("dctx", dctx);
-        context.put("dispatcher", dctx.getDispatcher());
-        context.put("delegator", dispatcher.getDelegator());
+        gContext.put("dctx", dctx);
+        gContext.put("dispatcher", dctx.getDispatcher());
+        gContext.put("delegator", dispatcher.getDelegator());
         try {
-            ScriptContext scriptContext = 
ScriptUtil.createScriptContext(context, protectedKeys);
+            ScriptContext scriptContext = 
ScriptUtil.createScriptContext(gContext, protectedKeys);
             ScriptHelper scriptHelper = 
(ScriptHelper)scriptContext.getAttribute(ScriptUtil.SCRIPT_HELPER_KEY);
             if (scriptHelper != null) {
-                context.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper);
+                gContext.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper);
             }
-            Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService),
 groovyClassLoader), GroovyUtil.getBinding(context));
+            Script script = 
InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService),
 groovyClassLoader), GroovyUtil.getBinding(gContext));
             Object resultObj = null;
             if (UtilValidate.isEmpty(modelService.invoke)) {
                 resultObj = script.run();


Reply via email to