public static void unregisterJMXBean ( ServletContext servletContext , String resourceType , String mBeanPrefix ) { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; if ( mbs != null ) { ObjectName jawrConfigMgrObjName = JmxUtils . getMBeanObjectName ( servletContext , resourceType , mBeanPrefix ) ; // register the jawrApplicationConfigManager if it's not already // done ObjectName appJawrMgrObjectName = JmxUtils . getAppJawrConfigMBeanObjectName ( servletContext , mBeanPrefix ) ; if ( mbs . isRegistered ( appJawrMgrObjectName ) ) { mbs . unregisterMBean ( appJawrMgrObjectName ) ; } if ( mbs . isRegistered ( jawrConfigMgrObjName ) ) { mbs . unregisterMBean ( jawrConfigMgrObjName ) ; } } } catch ( InstanceNotFoundException | MBeanRegistrationException e ) { LOGGER . error ( "Unable to unregister the Jawr MBean for resource type '" + resourceType + "'" , e ) ; } }
Unregister the JMX Bean