fixed bug 36261: connections logged as abandoned in translate task
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 16 Jun 2017 12:57:27 +0200
changeset 32243 a3af497e64de
parent 32242 594beb85eb49
child 32244 443c3cdbf841
fixed bug 36261: connections logged as abandoned in translate task

Connection for Translate task was kept unclosed in SessionInfo so when the pool
was destroyed it was logged as abandoned.

Fixed by closing it before destroying pool.
src-trl/src/org/openbravo/translate/Translate.java
--- a/src-trl/src/org/openbravo/translate/Translate.java	Wed Sep 06 16:51:30 2017 +0530
+++ b/src-trl/src/org/openbravo/translate/Translate.java	Fri Jun 16 12:57:27 2017 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,6 +32,7 @@
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.xerces.parsers.SAXParser;
 import org.openbravo.database.CPStandAlone;
+import org.openbravo.database.SessionInfo;
 import org.openbravo.utils.DirFilter;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -726,6 +727,9 @@
    * The method to close database connection.
    */
   private void destroy() {
+    // remove cached connection from thread local
+    SessionInfo.init();
+
     pool.destroy();
   }
 }