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 08:14:38 UTC
svn commit: r1509550 -
/ofbiz/branches/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Author: lektran
Date: Fri Aug 2 06:14:37 2013
New Revision: 1509550
URL: http://svn.apache.org/r1509550
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/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Modified: ofbiz/branches/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=1509550&r1=1509549&r2=1509550&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java (original)
+++ ofbiz/branches/release11.04/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java Fri Aug 2 06:14:37 2013
@@ -68,14 +68,17 @@ public final class GroovyEngine extends
}
Map<String, Object> params = FastMap.newInstance();
params.putAll(context);
- context.put("parameters", params);
+
+ Map<String, Object> gContext = FastMap.newInstance();
+ gContext.putAll(context);
+ gContext.put("parameters", 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 {
- Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context));
+ Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(gContext));
Object resultObj = null;
if (UtilValidate.isEmpty(modelService.invoke)) {
resultObj = script.run();
@@ -84,8 +87,8 @@ public final class GroovyEngine extends
}
if (resultObj != null && resultObj instanceof Map<?, ?>) {
return cast(resultObj);
- } else if (context.get("result") != null && context.get("result") instanceof Map<?, ?>) {
- return cast(context.get("result"));
+ } else if (gContext.get("result") != null && gContext.get("result") instanceof Map<?, ?>) {
+ return cast(gContext.get("result"));
}
} catch (GeneralException e) {
throw new GenericServiceException(e);