[PATCH 37 of 45] (issue1797) Increase session debug output

Wald Commits scm-commit at wald.intevation.org
Tue Mar 10 17:06:05 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1424799138 -3600
# Node ID 9bbce0edd36b38e5cfbc98f81c6c26980c7e5cb2
# Parent  fe7e9da6312a80cad6f96262efe04fbcebc0a578
(issue1797) Increase session debug output

diff -r fe7e9da6312a -r 9bbce0edd36b backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java
--- a/backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java	Tue Feb 24 17:16:14 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java	Tue Feb 24 18:32:18 2015 +0100
@@ -23,7 +23,9 @@
         new ThreadLocal<Session>() {
             @Override
             protected Session initialValue() {
-                return create();
+                Session session = create();
+                log.debug("Initial session value: " + session.hashCode());
+                return session;
             }
         };
 
@@ -38,16 +40,16 @@
     }
 
     public static Session acquire() {
-        log.debug("acquire");
         Session session = create();
+        log.debug("acquired session: " + session.hashCode());
         HOLDER.set(session);
         return session;
     }
 
     public static void release() {
-        log.debug("release");
         Session session = HOLDER.get();
         if (session != null) {
+            log.debug("releasing session: " + session.hashCode());
             try {
                 if (!session.isOpen()) {
                     /* If this check really works in all cases why does hibernate
@@ -63,6 +65,8 @@
                  */
                 log.error("Exception caught on session close! Session already closed?" + e.getMessage());
             }
+        } else {
+            log.debug("release called on NULL session.");
         }
         HOLDER.remove();
     }


More information about the Dive4Elements-commits mailing list