Author: lektran
Date: Fri Aug 2 01:19:53 2013
New Revision: 1509510
URL: http://svn.apache.org/r1509510
Log:
Fix bug preventing deadlock retries for groovy services, GenericEngine
implementations and services should never modify the service context
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=1509510&r1=1509509&r2=1509510&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Fri Aug 2 01:19:53 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();