Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
    Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is a simple application that can be monitored using JMX. In addition to the parameters that the JVM makes available for monitoring, it creates two MBean objects of its own.

The application consists of 3 classes: the HelloMBean interface to declare what operations and properties the custom MBeans make available, the Hello class that implements the interface -this is the object that can be monitored-, and the HelloAgent application that ties it all together.





After starting the application with



run the JMX console via "jconsole" from the command line. In the MBeans tab you'll see the hello1 and hello2 objects. Their "message" property can be manipulated independently, and the change count is updated accordingly. The application will quit automatically after 5 minutes.

Instead of jconsole you can also use VisualVM (which ships with the JDK) if you install its MBeans plugin.




CategoryCodeSamples CodeBarn
 
    Bookmark Topic Watch Topic
  • New Topic