[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2706) Add debugging option for detecting if a Session is unclosed

Mike Quilleash (JIRA) noreply at atlassian.com
Tue Jul 3 12:28:52 EDT 2007


Add debugging option for detecting if a Session is unclosed
-----------------------------------------------------------

                 Key: HHH-2706
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2706
             Project: Hibernate3
          Issue Type: New Feature
          Components: core
    Affects Versions: 3.2.1
         Environment: Any
            Reporter: Mike Quilleash


In H2 the Session would log a warning if close was not called.  This was removed in H3 due to performance issues of using a finalizer.

It can often be very difficult to track down unclosed Sessions so I would like to propose an option be added for restoring this functionality with an enhancement.

Add a Session implementation that wraps another Session which will
- Pass through all methods.
- Create but not throw an Exception on creation 
- Watch for "closure" methods and record as appropriate.
- Have a finalizer that checks for the Session not being closed and logs a warning and the exception created with the Session's stacktrace.

Then on any Session creation by SessionFactory, if the option is enabled, wrap the Session with the wrapper above.

This will have performance implications because of the finalizer and the Exception creation per Session.  But as a debugging tool it could be very useful.

I am open to creating a patch if there is interest.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list