PDA

View Full Version : MBeanExporter and DataSource Opening Connections?


sethladd
Aug 26th, 2005, 03:58 PM
Hello,

I'm trying out the MBeanExporter to expose our DBCP pool. This works great to expose it as an MBean, and I can easily see it in jconsole.

What seems odd is that every time I refresh (via the GUI) the number of active connections goes up by 2. I have done enough experimenting to be sure that it is not the result of some external usage. I am sure that by refreshing the mbean attributes, I am opening two connections and leaving them open.

I'm imagining that by refreshing, it is running through all getters, and thus calling getConnection().

Is there a way to selectively hide getters from a bean, so that they are not exposed by mbean attributes? That is, short of creating a read only interface for DataSource.

Thanks!
Seth

sethladd
Aug 26th, 2005, 03:59 PM
OK, sorry about that. I spoke way too soon.

On further investigation, I found the lovely MethodNameBasedMBeanInfoAssembler. Bingo, just what I need.

Thanks, and sorry for the noise. :)

sethladd
Aug 28th, 2005, 04:23 PM
Just for some closure on this topic, I submitted a new MBeanInfoAssembler implementation. This acts as the opposite of MethodNameBasedMBeanInfoAssembler, in that it provides a list of method names to ignore. All others are included.

http://opensource2.atlassian.com/projects/spring/browse/SPR-1256