询问c3p0正在使用多少个连接 [英] Asking c3p0 how many connections are in use
问题描述
有没有办法以编程方式询问c3p0正在使用多少个连接,或者可能在池耗尽时记录。
Is there a way to programatically ask c3p0 how many of it's connections are being used, or perhaps logs when the pool is exhausted.
推荐答案
如上面Austin评论所引用的URL所示,您可以使用JMX检查和修改正在运行的c3p0 PooledDataSources。
As indicated in the URL referenced by Austin's comment above, you can use JMX to inspect and modify running c3p0 PooledDataSources.
您也可以通过编程方式执行此操作。 c3p0的PooledDataSources有一个精心设计的API来检查它们的状态:
You can also do so programmatically. c3p0's PooledDataSources have an elaborate API for inspecting their state:
http://www.mchange.com/projects/c3p0/apidocs/com/mchange/v2/c3p0/PooledDataSource.html
如果您使用的是ComboPooledDataSource,则可以访问更丰富的API。
If you are using ComboPooledDataSource, you have access to an even richer API.
http://www.mchange.com/projects/c3p0/apidocs/com/mchange/ v2 / c3p0 / ComboPooledDataSource.html
我希望这会有所帮助!
这篇关于询问c3p0正在使用多少个连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!