c3p0 getNumBusyConnectionsDefaultUser()...忙是什么意思?

编程入门 行业动态 更新时间:2024-10-24 14:17:21
本文介绍了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()...忙是什么意思?

本文发布于:2023-08-01 04:22:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1265177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:getNumBusyConnectionsDefaultUser

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!