Thursday January 19, 2006 ![]() |
JMX, SNMP, Java, etc...Daniel Fuchs blogs on JMX, SNMP, Java, etc... |
Being a vain writer, I have devised a slightly polemic title in the faint hope of attracting readers. For indeed, what is the purpose to write if you are not read? Wicked is a term that has been used to qualify ill-defined design and planning problems. I wonder whether by using Weak MBeans, you wouldn't just be creating a Wicked Model. In a recent blog, Kohsuke Kawaguchi proposed a means to turn any MBean into a Weak MBean. His suggestion is both interesting and clever. But what is actually a Weak MBean? Weak MBeans is a concept that was introduced by
Eamonn McManus in his blog
Cleaning up an MBean when its resource dies. Basically, a Weak MBean is an MBean that only holds a WeakReference to its underlying resource, and which gets deregistered - or rather, deregisters itself, when the resource is garbage collected.
No matter how appealing this feature appears, I can't help feeling uneasy with this Weak MBean concept. Thus the question I ask myself is this: Could it be that Weak MBeans are simply symptoms of a Wicked Model? Having worked for a telco manufacturer (Alcatel), for a TMN company (Netmansys), and in the Java DMK / JMX team (Sun), has provided me with many exposures to management interfaces and information models. GDMO/CMIP, CIM/WBEM, SNMP, CORBA, Jini, JMX, to name a few, are technologies/protocols that I have either worked with, or investigated, or even in some case implemented, in the course of my job.
Let me take an example. In a previous entry, I have talked about the ThreadMXBean exposed by the Monitoring and Management API of Java SE 5.0 (Tiger). In a naive sort of way, Weak MBeans would have been a perfect match for modeling thread MBeans. However, for all the reasons explained here, it would most certainly have turned out to be a big mistake. Don't get me wrong.
Before making that kind of decision - I believe it worth to look at the implications and alternatives. In that respect, the ThreadMXBean example makes good food for thoughts. So now, how would I go about determining whether Weak MBeans are the right choice for managing my application?
Indeed, being an MBean developer myself, I usually design my MBeans with an eye at seeing, and an eye at testing. What matters to me is being able to see my MBeans with jconsole, and being able to interact dynamically with them - note: if you're not familiar with jconsole,
Mandy's article on jconsole is worth reading.
However, the developer's jconsole use-case may not be the only use case relevant for the situation, and these are a list of questions that may be worth asking:
If - after having asked all these questions, I am still convinced that using
Weak MBeans is the best alternative, then go ahead! I will use them.
Cheers to all!
|