Author: jacopoc
Date: Wed Jul 9 13:57:28 2014 New Revision: 1609156 URL: http://svn.apache.org/r1609156 Log: Applied fix from trunk for revision: 1609155 === 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/branches/release13.07/ (props changed) ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelService.java ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelServiceReader.java Propchange: ofbiz/branches/release13.07/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1609155 Modified: ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java?rev=1609156&r1=1609155&r2=1609156&view=diff ============================================================================== --- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java (original) +++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/GenericDispatcherFactory.java Wed Jul 9 13:57:28 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/branches/release13.07/framework/service/src/org/ofbiz/service/ModelService.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelService.java?rev=1609156&r1=1609155&r2=1609156&view=diff ============================================================================== --- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelService.java (original) +++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelService.java Wed Jul 9 13:57:28 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/branches/release13.07/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=1609156&r1=1609155&r2=1609156&view=diff ============================================================================== --- ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/ModelServiceReader.java Wed Jul 9 13:57:28 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 |
Free forum by Nabble | Edit this page |