details:   https://code.openbravo.com/erp/devel/pi/rev/cfd3f8102b4a
changeset: 32320:cfd3f8102b4a
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jun 19 15:16:26 2017 +0200
summary:   fixed bug 36274: abandoned connection in SessionListener

  Detach connection from current thread to allow it to be properly returned
  to pool.

  This is required whever the thread doing the actio is not handling an standard
  request.

diffstat:

 src/org/openbravo/erpCommon/security/SessionListener.java |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 75e216b9efe2 -r cfd3f8102b4a 
src/org/openbravo/erpCommon/security/SessionListener.java
--- a/src/org/openbravo/erpCommon/security/SessionListener.java Mon Jun 19 
10:54:05 2017 +0200
+++ b/src/org/openbravo/erpCommon/security/SessionListener.java Mon Jun 19 
15:16:26 2017 +0200
@@ -91,6 +91,8 @@
       }
     }
     SessionListener.context = null;
+    // detaching db connection from thread so can it be returned to pool
+    SessionInfo.init();
     log.info("Sessions deactivated in " + (System.currentTimeMillis() - t) + " 
ms");
   }
 
@@ -157,7 +159,6 @@
       activeHttpSessions.add(event.getSession());
     }
 
-
     if (RequestContext.get().getRequest() != null
         && 
AuthenticationManager.isStatelessRequest(RequestContext.get().getRequest())) {
       final String errorLog = 
RequestContext.get().getRequest().getRequestURL() + " "
@@ -198,6 +199,9 @@
       log.debug("Closed session" + sessionId);
     } catch (Exception e) {
       log.error("Error closing session:" + sessionId, e);
+    } finally {
+      // detaching db connection from thread so can it be returned to pool
+      SessionInfo.init();
     }
   }
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to