We are running a standalone application with Spring. We use a MySQL database. The datasource that has been configured is the "com.mchange.v2.c3p0.ComboPooledDataSource" from C3PO At regular interval :
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,009 BasicResourcePool$1DestroyResourceTask:run - Preparing to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1eaf8ae com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,009 C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager:destroyResource - Preparing to destroy PooledConnection: com.mchange.v2.c3p0.impl.NewPooledConnection@1eaf8ae com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,009 GooGooStatementCache:closeAll - ENTER METHOD: closeAll( com.mysql.jdbc.JDBC4Connection@f5b5a6 )! -- num_connections: 0 com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,009 GooGooStatementCache:closeAll - closeAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 0; checked out: 0; num connections: 0; num keys: 0 com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,010 NewPooledConnection:close - com.mchange.v2.c3p0.impl.NewPooledConnection@1eaf8ae closed by a client. java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:491) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,010 C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager:destroyResource - Successfully destroyed PooledConnection: com.mchange.v2.c3p0.impl.NewPooledConnection@1eaf8ae com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0 DEBUG 2011-04-01 10:27:47,010 BasicResourcePool$1DestroyResourceTask:run - Successfully destroyed resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1eaf8ae com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1 DEBUG 2011-04-01 10:27:47,017 GooGooStatementCache:checkinAll - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 0; checked out: 0; num connections: 0; num keys: 0 com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1 DEBUG 2011-04-01 10:27:47,017 C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager:acquireResource - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@961df6.acquireResource() returning. com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1 DEBUG 2011-04-01 10:27:47,017 BasicResourcePool:trace - trace com.mchange.v2.resourcepool.BasicResourcePool@d9fe20 [managed: 2, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@108d7cf) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1 DEBUG 2011-04-01 10:27:47,017 BasicResourcePool:decrementPendingAcquires - decremented pending_acquires: 0
The implementation of close of NewPooledConnection is indeed a bit exotic.
public synchronized void close() throws SQLException { close(null); } private void close(Throwable cause) throws SQLException { .... if(cause == null) { invalidatingException = NORMAL_CLOSE_PLACEHOLDER; if(logger.isLoggable(MLevel.FINEST)) logger.log(MLevel.FINEST, this + " closed by a client.", new Exception("DEBUG -- CLOSE BY CLIENT STACK TRACE")); ... }