【问题标题】:java bonecp connection-pool handling issuejava bonecp 连接池处理问题
【发布时间】:2013-07-31 17:02:46
【问题描述】:

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

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

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

【问题讨论】:

    标签: java connection-pooling bonecp


    【解决方案1】:

    我知道这是旧的并且可能已经解决了,但是要获取您的调试信息,您还需要设置 setCloseConnectionWatchTimeoutsetCloseConnectionWatchTimeoutinMs

    【讨论】:

    • 我很确定添加答案总是有帮助的,无论问题有多老(只要答案有帮助)。这当然对我有帮助。
    猜你喜欢
    • 1970-01-01
    • 2013-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-13
    • 2013-03-14
    相关资源
    最近更新 更多