Hello,
Thank you for the quick clarification!
2 more questions below.
I have changed my code to call Session's close() at the end of each user's request.
In order to get my code to work properly with this new setup, I had to add the following logic to the piece of code that retrieves Session from ThreadLocal:
Code:
if (!ses.isConnected())
{
ses.reconnect();
}
I am trying to find out what exacly close() does and what exactly reconnect() does.
I looked at the Javadoc for Session, but it is rather sparse.
Does close() completely close the underlying JDBC connection, or does it merely return it to the connection pool? (I am using Hibernate with DBCP)
The Javadoc for reconnect() says "Obtains a new JDBC connection". Does that mean from the pool?
I am basically wondering what the performance impact of close() and reconnect() calls are.
If close() means "return JDBC connection to the pool", I'm happy. :)
If reconnect() means "get a new JDBC connection from the pool", I'll be happy again.
If either of those two methods skip the pool and completely close the JDBC connection or get a brand new (not pooled) JDBC connection, then I'll be worried about performance.
Thanks,
Otis