Multi threads + Hibernate (ERROR: Connection leak detected: there are 1 unclosed)

Hello
I use multi threads to create long request to database. Each thread starts processing with opening single session sessionFactory.openSession() I manually create exceptional situation by shutting down Application during working processes in background. I get the log error "ERROR: Connection leak detected: there are 1 unclosed connections upon shutting down pool "

What is the right way to process this exceptional situation ?

Ive tried sessionFactory.getCurrentSession().close(); it does not help. Actually Id like to know how to manage case if I have multi threads each has a session working in background?!

Next thing is even if I have multy threads each has a session working in background I get log error only about 1 unclosed connection, despite I`m observing many connections in database
Why log says only one connection ?

Igor

May be it’s not one of yours… but one used by the framework… to ping the health of the db…