Hope this helps you :-)
What about if the class was not created by the one doing the monitoring . For example, in profilers like VisualVM, we can attach it to any running jvm and monitor any class instance in it without having to first modify the classes to implement MBean (it seems to me that a JMX Manageable Resource have to be a class implement some JMX specific intefaces, right?).
John Pradeep.v wrote:Hi Alec,
I think you can achieve this using AOP (AspectJ load time weaving) to point cut any object creation and expose the statistics through JMX MBean.
you can have a look at AspectJ load time weaving for better idea.
Hi John nice to see you here. I just had a chat with you in the evening. :-)
One more way would be to extend the class and implement the JMX interfaces and expose this class as MBean. Within the methods of the subclass just delegate it to the super class by using super. Let me know if this work out for you.
Also if you are using Spring you can go ahead and expose this as MBean as Spring can expose any bean as MBean. Advantage: you need not have to implement any JMX interfaces ;-)
Hope this help you.