Friday, November 11, 2011

Looking for a few good mbeans

Looking for my MBeans, since they don't seem to be where I expect them, leads me to OQL in the Eclipse Memory Analyzer. The documentation is terrible, really. Things don't seem to work as advertised, except that sometimes they do. The errors are very obscure, and the similarity to SQL may be more trouble than help.

So, I'm trying to find my beans with a query like this:
SELECT OBJECTS inbounds(nob) FROM com.sun.jmx.mbeanserver.NamedObject nob WHERE classof(nob.object).getName() NOT LIKE "org.apache.*"

And that does indeed work: they exist. The 'not like org apache' is because tomcat has beans too: they're nice, but I don't actually care about them now.

I'd like to find the MBeanServer instance that 'owns' them, so I started trying to follow the inbound references, but here:

SELECT OBJECTS inbounds(hme) FROM java.util.HashMap$Entry hme WHERE hme.value != null AND classof(hme.value).getName() = "com.sun.jmx.mbeanserver.NamedObject"

I start to get stuck: hash map entries are in arrays, owned by hash map instances, etc. and I'm not sure how to find my object in an array yet.

This is where the documentation really lets me down: it probably contains the information I need, but the various operators, etc, don't seem to do what I expect. Ugh. And the errors are very unclear (often simply "your query returned no results")

No comments:

Post a Comment