You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2013/08/02 04:40:56 UTC

svn commit: r1509515 - /ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java

Author: lektran
Date: Fri Aug  2 02:40:56 2013
New Revision: 1509515

URL: http://svn.apache.org/r1509515
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/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java

Modified: ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=1509515&r1=1509514&r2=1509515&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java (original)
+++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java Fri Aug  2 02:40:56 2013
@@ -105,19 +105,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();