我知道这是一个非常基本的问题,但是我想对忙的含义有更深入的了解。我已仔细检查了所有连接的连接。我知道在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()...忙是什么意思?
发布评论