hi,
how are you observing the "orphaned Connections"? what is it that you are actually seeing?
c3p0 maintains statistics about "unclosed orphaned Connections", which as you note occur when a c3p0 pool is "soft reset" — the pool is refreshed with new Connections from the database, but any checked-out Connections are not destroyed, but considered "orphaned". They will be close()ed when clients try to check them back into the pool.
it's quite possible to have Connections be orphaned even if you never explicitly call a softReset() method. Should a c3p0 DataSource observe an error that signals (according its ConnectionTester) that currently pooled Connections are likely to be invalid, the pool will softReset() internally. so, if you've observed database problems/Connection errors etc, its quite possible that c3p0 saw an Exception, deemed it likely that all pooled Connections have broken, and reset the pool.
if this is causing you problems somehow, you can write your own ConnectionTester that never returns ConnectionTester.DATABASE_IN_INVALID. (You can delegate to c3p0's default ConnectionTester for most of the implementation.)
good luck!
Steve
p.s. c3p0-0.8.5.x is very old; you might try upgrading to newer versions. any newer c3p0 is a drop-in replacement for previous versions, just copy a newer c3p0 jar file into hibernate's lib directory and remove the old one. if you have any problems with the newer version, downgrading is just a matter of switching jar files once again.
|