How to develop JMX MBean in 5 minutes

  1. Create a class named say Abc.
  2. To expose it as MBean, create an interface AbcMBean.
  3. Abc should now implement AbcMBean.
  4. Get information with getMethodName() methods
  5. Set information with setMethodName() methods
  6. Register the MBean class separately:
    java.lang.management.ManagementFactory.getPlatformMBeanServer().registerMBean(new ClassName(), new ObjectName(”com.taragana:name=NameofService”));

That’s it!