This discussion is archived
0 Replies Latest reply: Dec 22, 2012 9:52 AM by 829249 RSS

Using JMX and MBeans

829249 Newbie
Currently Being Moderated
I've been experimenting with Java instrumentation with MBeans.

I created a small app to try out some of the JMX features. The app has a class that I would like to monitor with MBeans. So I created to interfaces to function as MBeans and then had the class in my app implement both interfaces.

I then wrote a class with only a main() method to instantiate my class and call the methods it implemented from my MBean interface. In the main method I provided the code to get an MBeanServer object and then use that to register my class that implemented the MBean interfaces. My intention was to try this out, but before I did I commented out the code needed to register the class with the MBean server. I did this because I assumed the implemented interface methods would be available for monitoring without registering and it made me think if I can monitor the instrumented class like this why would I need the MBean server.

So what is the purpose of the JMX framework and MBeans if I can instrument any class as described above?

Is it necessary to register only to be able to monitor from outside the JMV where the instrumented class is running?

Or are there other advantages\features\reasons for registering with the MBean server?

Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points