java bonecp连接池处理问题

时间:2013-07-31 08:55:28

标签: java connection-pooling bonecp

我无法在任何地方找到网络 我如何启用连接监视的代码示例 因为我在日志中收到此消息

153624 [com.google.common.base.internal.Finalizer] WARN 
com.jolbox.bonecp.ConnectionPartition - BoneCP    detected 
an unclosed connection and will now attempt to close it 
for you. You should be closing this connection in your 
application - enable connectionWatch for additional debugging assistance.

这是我的定义:

BoneCPConfig config = new BoneCPConfig();
Class.forName(loc.driver);  // load the DB driver
config.setJdbcUrl(loc.url); // set the JDBC url
config.setUsername(loc.user);           // set the username
config.setPassword(loc.password);               // set the password
config.setMinConnectionsPerPartition(5);
config.setMaxConnectionsPerPartition(10);
config.setPartitionCount(5);
config.setAcquireIncrement(5);
//config.setCloseConnectionWatch(true);
connectionPool = new BoneCP(config);

我也使用了:

 config.setCloseConnectionWatch(true);

但它没有给我额外的调试帮助。

1 个答案:

答案 0 :(得分:1)

我意识到这已经过时且可能已经解决,但要获取调试信息,您还需要设置setCloseConnectionWatchTimeoutsetCloseConnectionWatchTimeoutinMs