Bug 53445

Summary: Support consistent Jmx object naming strategy across managed resources
Product: Tomcat Modules Reporter: Alex Franken <alexfranken>
Component: jdbc-poolAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Alex Franken 2012-06-20 19:20:53 UTC
Tomcat JDBC Pool Versions tested: 7.0.27 & 7.0.28
More of an inquiry.  Let me preface by saying we have recently adopted this pool and are very pleased so far.

Currently, Jmx managed resources like ConnectionPool and SlowQueryReportJmx are registered under the same domain (i.e. tomcat.jdbc).  Some users may want to employ an alternate object naming strategy.  With DataSource#createObjectName it is relatively easy to change the ConnectionPool ObjectName (i.e. subclass).  However, with SlowQueryReportJmx, due to a static getObjectName method, it requires overriding additional methods which is less desirable.
It appears that ConnectionPool has a constant POOL_JMX_TYPE_PREFIX.  SlowQueryReportJmx appears to use this but DataSource does not? 

Is there any reason that the SlowQueryReportJmx#getObjectName method is static?
What about registering an object naming strategy with the pool that the various components would use, facilitating consistency?  This would mitigate the need to override just to alter the ObjectName.

Reference: Spring MBean exporters and their ObjectNamingStrategy interface.

Comment 1 Filip Hanik 2012-06-26 19:09:08 UTC
Fixed in r1354173
I'll consider a naming strategy for when we refactor jdbc-pool, but that will be in Tomcat trunk (8)
Comment 2 Filip Hanik 2012-06-26 19:12:23 UTC
Will be available in Tomcat 7.0.29 and onwards through r1354174