Author: jacopoc
Date: Wed Jul 9 13:56:39 2014
New Revision: 1609155
URL: http://svn.apache.org/r1609155
Log:
This is a slightly modified version of the work contributed by Simone Viani in
OFBIZ-5619: when a service model was cloned (e.g. when runSync/call-service are
invoked passing the require-new-transaction flag) the service was executed with
use-transaction set to true, even if the called service is defined to not use
it. Also added some checks to make sure that if require-new-transaction is true
then also use-transaction must be true.
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java?rev=1609155&r1=1609154&r2=1609155&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java
Wed Jul 9 13:56:39 2014
@@ -89,6 +89,9 @@ public class GenericDispatcherFactory im
// clone the model service for updates
ModelService cloned = new ModelService(service);
cloned.requireNewTransaction = requireNewTransaction;
+ if (requireNewTransaction) {
+ cloned.useTransaction = true;
+ }
if (transactionTimeout != -1) {
cloned.transactionTimeout = transactionTimeout;
}
@@ -112,6 +115,9 @@ public class GenericDispatcherFactory im
// clone the model service for updates
ModelService cloned = new ModelService(service);
cloned.requireNewTransaction = requireNewTransaction;
+ if (requireNewTransaction) {
+ cloned.useTransaction = true;
+ }
if (transactionTimeout != -1) {
cloned.transactionTimeout = transactionTimeout;
}
@@ -129,6 +135,9 @@ public class GenericDispatcherFactory im
// clone the model service for updates
ModelService cloned = new ModelService(service);
cloned.requireNewTransaction = requireNewTransaction;
+ if (requireNewTransaction) {
+ cloned.useTransaction = true;
+ }
if (transactionTimeout != -1) {
cloned.transactionTimeout = transactionTimeout;
}
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=1609155&r1=1609154&r2=1609155&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Wed
Jul 9 13:56:39 2014
@@ -225,8 +225,12 @@ public class ModelService extends Abstra
this.auth = model.auth;
this.export = model.export;
this.validate = model.validate;
- this.useTransaction = model.useTransaction || true;
+ this.useTransaction = model.useTransaction;
this.requireNewTransaction = model.requireNewTransaction;
+ if (this.requireNewTransaction && !this.useTransaction) {
+ // requireNewTransaction implies that a transaction is used
+ this.useTransaction = true;
+ }
this.transactionTimeout = model.transactionTimeout;
this.maxRetry = model.maxRetry;
this.permissionServiceName = model.permissionServiceName;
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=1609155&r1=1609154&r2=1609155&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
Wed Jul 9 13:56:39 2014
@@ -213,6 +213,11 @@ public class ModelServiceReader implemen
service.validate =
!"false".equalsIgnoreCase(serviceElement.getAttribute("validate"));
service.useTransaction =
!"false".equalsIgnoreCase(serviceElement.getAttribute("use-transaction"));
service.requireNewTransaction =
!"false".equalsIgnoreCase(serviceElement.getAttribute("require-new-transaction"));
+ if (service.requireNewTransaction && !service.useTransaction) {
+ // requireNewTransaction implies that a transaction is used
+ service.useTransaction = true;
+ Debug.logWarning("In service definition [" + service.name + "] the
value use-transaction has been changed from false to true as required when
require-new-transaction is set to true", module);
+ }
service.hideResultInLog =
!"false".equalsIgnoreCase(serviceElement.getAttribute("hideResultInLog"));
// set the semaphore sleep/wait times