javaboncp连接池处理问题

标签 java connection-pooling bonecp

我找不到任何地方有网络 我如何启用连接 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);

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

最佳答案

我意识到这个问题很旧并且可能已经解决了,但是要获取调试信息,您还需要设置 setCloseConnectionWatchTimeoutsetCloseConnectionWatchTimeoutinMs

关于javaboncp连接池处理问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17965835/

相关文章:

java - Spring hibernate关于延迟加载的错误

java - 修剪字符串并检查字符串是否不为空

java - 将列表 <Integer> 处理到线程

java - 如何在 Jboss 中以编程方式监控连接池?

postgresql - Slick and bonecp : org. postgresql.util.PSQLException : FATAL: sorry, 太多客户端已经错误

mysql - Tomcat启动时如何避免分钟延迟

java - "Java.exe"以代码 1 退出(Proguard 问题)

java - 尝试设置数据库连接的初始池大小(spring-boot)

mysql - 关于如何使用 mysql 和数据库池设置 tomcat 的好教程是什么?

java - BoneCP SLF4J ClassNotFoundException