获取连接池中的空闲连接数 [英] Get number of free connections in connection pool

查看:1504
本文介绍了获取连接池中的空闲连接数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,Spring使用org.apache.commons.dbcp.BasicDataSource类管理连接池。是否可以获得当前时间内有多少个免费或使用的连接?

In my project Spring manages connection pool with org.apache.commons.dbcp.BasicDataSource class. Is possible to get how many connections are free or used in current time?

谢谢。

推荐答案

从javadocs,您应该能够从 getNumIdle() getNumActive()方法,如果你能得到BasicDataSource的实例。

From the javadocs, you should be able to read this from the getNumIdle() and getNumActive() methods, if you can get an instance of the BasicDataSource.

这篇关于获取连接池中的空闲连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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