c3p0 getNumBusyConnectionsDefaultUser()...忙是什么意思? [英] c3p0 getNumBusyConnectionsDefaultUser()... What does busy mean?

查看:348
本文介绍了c3p0 getNumBusyConnectionsDefaultUser()...忙是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个非常基本的问题,但是我想对忙的含义有更深入的了解。我已仔细检查了所有连接的连接。我知道在c3p0中,该池将拦截对close()的调用,并将基础连接检回到该池中。我希望繁忙的连接数趋向于零,但这不会发生。有什么想法吗?连接保持繁忙状态要持续多长时间?关闭连接后,连接不应该变得忙碌吗?

解决方案

确定...最终,我通过查看mchange的DEBUG日志语句来弄清楚这一点。每5秒钟进行一次检查过期资源。如果在该窗口之前获得并使用连接,然后在该窗口内调用 getNumConnectionsDefaultUser(),则可能无法获得准确的计数,因为该连接可能在窗口关闭之前被标记为s忙碌而变得忙碌。



本质上(我认为),c3p0不会根据状态变化维护自己的计数器,而是每五秒钟循环一次收集连接以检查当前状态。 / p>

I know this is a very basic question, but I would like a deeper understanding of what "busy" means. I have done a double check that I close all my connections. I know that in c3p0, "the pool will intercept the call to close() and check the underlying Connection back into the pool." I would expect the number of busy connections to trend to zero, but this does not happen. Any ideas why? How long does a connection stay in the "busy" state? Shouldn't the connection become unbusy when I close it? Thx in advance.

解决方案

OK... I finally figured this out by watching the DEBUG log statements from mchange. There is a "check for expired resources" every 5 seconds. If you get and use a connection just before that window and then you call "getNumConnectionsDefaultUser()" within that window you may not get an accurate count because the connection could be marked s busy and become unbusy before the window closes.

Essentially (I think), c3p0 does not maintain its own counters based on a change in status, it cycles through the collection of connections every five seconds checking current status.

这篇关于c3p0 getNumBusyConnectionsDefaultUser()...忙是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆