commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cyrille Le Clerc (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (DBCP-292) Adds an mbean for exposing metrics around a BasicDataSource via JMX
Date Tue, 23 Nov 2010 23:38:14 GMT

    [ https://issues.apache.org/jira/browse/DBCP-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934701#action_12934701
] 

Cyrille Le Clerc edited comment on DBCP-292 at 11/23/10 6:37 PM:
-----------------------------------------------------------------

For those who are using Spring, we packaged a JMX enabled extension of DBCP BasicDataSource
at [Google Code - XebiaManagementExtras - ManagedBasicDataSource|http://code.google.com/p/xebia-france/wiki/ManagedBasicDataSource].
A Spring XML namespace configuration allows a compact datasource declaration looking like:


{code:xml}
<beans ...>

   <!-- MBeanExporter is in charge of registering the DBCP DataSource JMX MBean -->
   <context:mbean-export />

   <management:dbcp-datasource id="myDataSource">
      <management:url value="jdbc:h2:mem:dbcp-test" />
      <management:driver-class-name value="org.h2.Driver" />
      <management:username value="sa" />
      <management:password value="" />
      <management:max-active value="10" />
      <!-- ... any other useful configuration param -->
   </management:dbcp-datasource>

</beans>
{code}

The associated JMX MBean exposes :
* Monitoring indicators : NumActive and NumIdle,
* Read / write configuration parameters to tune the datasource at runtime: MaxActive, MaxIdle,
MinIdle and MaxWait,
* Read only parameters to ease controls: Url, Username and DefaultAutoCommit.


      was (Author: cleclerc):
    For those who are using Spring, we packaged a JMX enabled extension of DBCP BasicDataSource
at [Google Code - XebiaManagementExtras - ManagedBasicDataSource|http://code.google.com/p/xebia-france/wiki/ManagedBasicDataSource].
A Spring XML namespace configuration allows a compact datasource declaration looking like:


{code:xml}
<beans ...>

   <!-- MBeanExporter is in charge of registering the DBCP DataSource JMX MBean -->
   <context:mbean-export />

   <management:dbcp-datasource id="myDataSource">
      <management:url value="jdbc:h2:mem:dbcp-test" />
      <management:driver-class-name value="org.h2.Driver" />
      <management:username value="sa" />
      <management:password value="" />
      <management:max-active value="10" />
      <!-- ... any other useful configuration param -->
   </management:dbcp-datasource>

</beans>
{code}

  
> Adds an mbean for exposing metrics around a BasicDataSource via JMX
> -------------------------------------------------------------------
>
>                 Key: DBCP-292
>                 URL: https://issues.apache.org/jira/browse/DBCP-292
>             Project: Commons Dbcp
>          Issue Type: New Feature
>    Affects Versions: 1.2.2
>            Reporter: David Horne
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: BasicDataSourceMBean.patch
>
>
> The attached patch adds an mbean that exposes the following metrics of a BasicDataSource
via jmx: numActive, numIdle, maxActive, maxIdle, minIdle & maxWait.
> I have put it in a new package: org.apache.commons.dbcp.management but feel free to put
it in any package you see fit.
> If using Spring the bean can be configured a little something like this:
> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
>  ...
> </bean>
> <bean id="dataSourceMBean" class="org.apache.commons.dbcp.management.BasicDataSourceMBean">
> 	<constructor-arg ref="dataSource"/>
> </bean>
> <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporter">
> 	<property name="beans">
> 		<map>
> 			<entry key="DBCP:name=dataSource" value-ref="dataSourceMBean"/>
> 		</map>
> 	</property>
> </bean>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message