A lot of monitoring information is available through the BoneCP connection pool class ( BoneCP ). This is registered as a managed bean, so if you are using jconsole or some other monitoring tool, you should get a detailed overview of this information, for example:

If necessary, you can get an instance of BoneCP from BoneCPDataSource using BoneCPDataSource#getPool() :
public String getConnectionStatus() { String status = "unknown"; if (dataSource instanceof BoneCPDataSource) { BoneCPDataSource bcpDataSource = (BoneCPDataSource) dataSource; BoneCP bcp = bcpDataSource.getPool(); status = "JDBC connections: " + bcp.getTotalLeased() + " in use / " + bcp.getTotalFree() + " in pool / total created " + bcp.getTotalCreatedConnections(); } return status; }
Frvabe
source share