Skip to main content

Disappointed with JMX

Posted by kohsuke on December 10, 2005 at 11:35 PM PST

As a part of the Dalma workflow engine project, I'm implementing the JMX support for the workflow container, so that it can be managed remotely --- for example, you can start/stop workflow applications, check the running conversations, etc.

I thought my use case was a pretty simple one, so I was hoping it would be easy. But unfortunately it turns out that there are problems.

Firstly, I didn't like that JMX wants every MBean to be named. When you have a hierarchy of objects, this is very messy (see MBean names that Tomcat uses for real-world examples), since your name would have to say something like "the name is Server=X, Service=Y, Engine=Z, Host=W, and Realm=U".) I thought it would have been a lot more simple if JMX allowed anonymous MBean, and allow MBeans to return a reference to other MBeans. In that way, in the Tomcat example, I can just name the root server object, and define accessor methods to return other MBeans. That would also let me build my object model lazily.

Secondly, once you register an object to MBeanServer, it doens't seem to be GC-ed unless you explicitly unregister it. But if you think about when you'd want to unregister it, that's when your object is no longer used (which is when it's GC-ed.) So there's a chicken-and-egg problem going on here, and unless you are careful, it creates memory leak. I thought it would have been nice if MBeanServer doesn't maintain a strong reference to a MBean object.

I've heard that Mustang comes with a much improved JMX, so I hope those are addressed in Mustang.

Related Topics >>