This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ae70318  Improved: Added support to consider non-default transaction 
timeout for Groovy and Simple event handlers.(OFBIZ-11607) (#77)
ae70318 is described below

commit ae70318fc84cdca6111455bcc33bfee5a0e16a55
Author: ravilodhi <[email protected]>
AuthorDate: Sun Apr 26 12:47:30 2020 +0530

    Improved: Added support to consider non-default transaction timeout for 
Groovy and Simple event handlers.(OFBIZ-11607) (#77)
    
    * Improved: Added support to consider non-default transaction timeout for 
Groovy and Simple event handlers.(OFBIZ-11607)
    
    * Revert "Improved: Added support to consider non-default transaction 
timeout for Groovy and Simple event handlers.(OFBIZ-11607)"
    
    This reverts commit 934eaa4539697ca2a77d9f715b1615b0fac603bb.
    
    * Improved: Added support to consider non-default transaction timeout for 
Groovy and Simple event handlers.(OFBIZ-11607)
    
    Co-authored-by: Ravi Lodhi <[email protected]>
---
 .../main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java    | 3 ++-
 .../main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java
index a502a03..addf4ab 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java
@@ -77,7 +77,8 @@ public class GroovyEventHandler implements EventHandler {
     public String invoke(Event event, RequestMap requestMap, 
HttpServletRequest request, HttpServletResponse response) throws 
EventHandlerException {
         boolean beganTransaction = false;
         try {
-            beganTransaction = TransactionUtil.begin();
+            int timeout = Integer.max(event.transactionTimeout, 0);
+            beganTransaction = TransactionUtil.begin(timeout);
 
             Map<String, Object> context = new HashMap<>();
             context.put("request", request);
diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java
index 46e3312..3175b1e 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SimpleEventHandler.java
@@ -66,7 +66,8 @@ public class SimpleEventHandler implements EventHandler {
 
         if (Debug.verboseOn()) Debug.logVerbose("[Processing]: SIMPLE Event", 
MODULE);
         try {
-            beganTransaction = TransactionUtil.begin();
+            int timeout = Integer.max(event.transactionTimeout, 0);
+            beganTransaction = TransactionUtil.begin(timeout);
             String eventReturn = SimpleMethod.runSimpleEvent(xmlResource, 
eventName, request, response);
             if (Debug.verboseOn()) Debug.logVerbose("[Event Return]: " + 
eventReturn, MODULE);
             return eventReturn;

Reply via email to