Thursday, October 23, 2008

Using JMX

JMX is an integral part of J2EE but mostly neglected compared to other aspects. Here's some practical learnings.

Understanding
JMX is used to manage your application (or even the application server). It's a very simple 3-step process.
  1. You write your Management Beans or MBeans to provide the management functionality.
  2. Then your register your MBean with the MBean Agent (MBean Server).
  3. Now you can manage your application by connecting to the MBean Server and calling the required functionality.
When to use
The decision of when to forgo the use of configuration files and code to update settings and when to use JMX is not clear-cut. It's definitely a better idea when program management forms a larger part since JMX is very scalable. But I think JMX is an even better idea when you have limited managment requirements and don't want to add a custom user interface module just for the management. In this case, JMX allows you to provide the neccessary interface with just 10 lines of code and use of the ubiquitous JConsole to do the agent connection (see my Using JConsole to connect to an MBeanServer post on how to use JConsole for this).

No comments:

Post a Comment

 
Superblog Directory