How to develop JMX MBean in 5 minutes

By Partho, Gaea News Network
Tuesday, November 17, 2009

<b>java</b> Java Management Extensions (JMX) allows remote clients to connect with JVM, and manage, monitor as well as run applications in that JVM. At the core of JMX specification lies the Mbeans that manages the JMX facility.  MBeans are controllable end-points of an application for a developer, where the remote clients can view the activity and simultaneously control the inner workings. Most of the developers are hesitant to adopt and utilize the JMX specification. In actuality, JMX offers an easy way to explore the key inner workings of the application, which helps in optimizing the manageability and monitoring facilities of the application. To reduce the complications we decided to would show you how to develop JMX MBean in 5 minutes.

Step 1: Create a class say Abc

Step 2: Create a class named say Abc.

Step 3: To expose it as MBean, create an interface AbcMBean. Abc should now implement AbcMBean.

Step 4: Get information with getMethodName() methods

Step 5: Set information with setMethodName() methods

Step 6: Register the MBean class separately

java.lang.management.ManagementFactory.getPlatformMBeanServer().registerMBean(new ClassName(), new ObjectName(”com.taragana:name=NameofService”));

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :