我找不到任何地方有网络 我如何启用连接 watch 的代码示例 因为我在日志中收到此消息
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);
但它没有给我额外的调试帮助。
最佳答案
我意识到这个问题很旧并且可能已经解决了,但是要获取调试信息,您还需要设置 setCloseConnectionWatchTimeout
或 setCloseConnectionWatchTimeoutinMs
。
关于javaboncp连接池处理问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17965835/