1

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

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);

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

4

1 回答 1

1

我意识到这是旧的并且可能已经解决了,但是要获取您的调试信息,您还需要设置setCloseConnectionWatchTimeoutor setCloseConnectionWatchTimeoutinMs

于 2013-11-02T18:02:47.357 回答