expose c3po dataSourceName in jmx
Is there a way to make c3p0 to register to jmx with its dataSourceName? Currently my c3p0 data create a random name to register to jmx even though it has its dataSourceName. For example my configuration in spring is:
<bean id="services" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="dataSourceName" value="mySQLDataSource"/>
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl">
<value>${jdbcUrl}</value>
</property>
<property name="user">
<value>${user}</value>
</property>
<property name="password">
<value>${password}</value>
</property>
<property name="initialPoolSize" value="1" />
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="10" />
<property name="maxIdleTime" value="开发者_StackOverflow中文版10" />
</property>
</bean>11
Not sure if C3P0 allows that, but that feature is present in BoneCP (http://jolbox.com).
It's definitely possible!
I've gotten it working with the .properties file, myself, but the documentation says it will also work with an XML file.
With your Spring approach it might be less confusing to make a properties file.
Mine is at webapps/[appname]/WEB-INF/classes/c3p0.properties
References: - http://www.mchange.com/projects/c3p0/#jmx_configuration_and_management - http://www.mchange.com/projects/c3p0/#c3p0_conf
精彩评论