comparing with http://192.168.147.181/hg/core
searching for changes
changeset:   15412:c5011eba602a
tag:         tip
parent:      15409:0287ddee535f
user:        Salvador Zapata <salvador.zapata@openbravo.com>
date:        Mon May 21 16:57:27 2012 +0200
summary:     DalBaseProcess close the connection depending on the process bundle

diff -r 0287ddee535f -r c5011eba602a src/org/openbravo/scheduling/ProcessBundle.java
--- a/src/org/openbravo/scheduling/ProcessBundle.java	Tue May 15 20:16:54 2012 +0100
+++ b/src/org/openbravo/scheduling/ProcessBundle.java	Mon May 21 16:57:27 2012 +0200
@@ -70,6 +70,8 @@
 
   private String processRequestId;
 
+  private boolean closeConnection;
+
   private String impl;
 
   private Map<String, Object> params;
@@ -121,6 +123,7 @@
     this.processId = processId;
     this.context = new ProcessContext(vars, client, organization, roleSecurity);
     this.channel = channel;
+    this.closeConnection = true;
   }
 
   /**
@@ -266,6 +269,14 @@
     this.channel = channel;
   }
 
+  public boolean getCloseConnection() {
+    return closeConnection;
+  }
+
+  public void setCloseConnection(boolean closeConnection) {
+    this.closeConnection = closeConnection;
+  }
+
   /**
    * Initializes the ProcessBundle, setting its implementation, parameters and actual Java class
    * implementation that will be executed by the Quartz Scheduler or a direct ProcessRunner
diff -r 0287ddee535f -r c5011eba602a src/org/openbravo/service/db/DalBaseProcess.java
--- a/src/org/openbravo/service/db/DalBaseProcess.java	Tue May 15 20:16:54 2012 +0100
+++ b/src/org/openbravo/service/db/DalBaseProcess.java	Mon May 21 16:57:27 2012 +0200
@@ -64,9 +64,19 @@
       errorOccured = false;
     } finally {
       if (errorOccured) {
-        OBDal.getInstance().rollbackAndClose();
+        if (bundle.getCloseConnection()) {
+          OBDal.getInstance().rollbackAndClose();
+        } else {
+          bundle.getConnection().releaseRollbackConnection(bundle.getConnection().getConnection());
+        }
+
       } else {
-        OBDal.getInstance().commitAndClose();
+        if (bundle.getCloseConnection()) {
+          OBDal.getInstance().commitAndClose();
+        } else {
+          bundle.getConnection().releaseCommitConnection(bundle.getConnection().getConnection());
+        }
+
       }
 
       // remove the context at the end, maybe the process scheduler

