delpouve wrote:
otis, you're really mistaken all this stuff
all is joined, respect threadlocal session, understand what disconnexion mean, don't forget about transaction and last advice, use proxool not dbcp, dbcp is buggy
Could you please be a bit more specific? Is my use of openSession(), reconnect(), and disconnect() wrong?
I'm doing my testing in a test environment.
1 user only
1 request at a time
- initial state: no Hibernate Sessions, no DB connections
- request #1: openSession (new Session)
- post request #1: Session disconnected, 1 connection in the pool
- wait, have a coffee
- request #2: use the same Session, it was disconnected, so call reconnect() on it
- post request #2: Session disconnected,
2 connections in the pool
If I keep repeating this, I will get 3,4,5,....N connections, and I will run out of pooled DB connections.
My feeling is that something is not returning connections back to the pool. Possible?
Why didn't Session in request #2 use that existing idle session from the pool? Should that happen?
What am I supposed to do to return DB connections back to the pool, and to re-use idle connections from the pool?
I thought:
-- session.reconnect() -- gets idle connection from the pool
-- session.disconnect() -- returns the connection to the pool
Apparently, though, that is not happening.
Thanks,
Otis