Java – how to monitor c3p0 connections

I used hibernate in the JBoss war and c3p0 for connection pool. They are all in a hibernate in my classpath cfg. Configuration in XML configuration file

<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

I see server Log generates interesting rows about connection pools:

DEBUG [com.mchange.v2.resourcepool.BasicResourcePool] trace com. mchange. v2. resourcepool. BasicResourcePool@63f5e4b6 [managed:10,unused:9,excluded:0]

For my monitoring pool (I use Nagios), I want to provide a JSP to tell us how many connections are being used and how many connections are empty, as the log file says

How to ask c3p0 how many managed and unused connections are there?

Solution

You can monitor the connection pool through JMX From the document:

By the way, Nagios seems to have JMX plug-ins, and you won't be forced to use JSP

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>