Here you can find the source of registerMBean(Object bean, MBeanServer mBeanServer, ObjectName objectName)
static void registerMBean(Object bean, MBeanServer mBeanServer, ObjectName objectName) throws Exception
//package com.java2s; //License from project: Apache License import javax.management.MBeanServer; import javax.management.ObjectName; public class Main { static void registerMBean(Object bean, MBeanServer mBeanServer, ObjectName objectName) throws Exception { if (!mBeanServer.isRegistered(objectName)) { mBeanServer.registerMBean(bean, objectName); } else {// w w w .j a va2 s .c o m unregisterMBean(mBeanServer, objectName); mBeanServer.registerMBean(bean, objectName); } } static void unregisterMBean(MBeanServer mBeanServer, ObjectName objectName) throws Exception { if (mBeanServer.isRegistered(objectName)) { mBeanServer.unregisterMBean(objectName); } } }