code: public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception {
        if (mBeanServer.isRegistered(objectName)) {
           SecurityActions.unregisterMBean(objectName, mBeanServer);
           log.tracef("Unregistered %s", objectName);
        }
     }
docs: Unregister the MBean located under the given {@link ObjectName}
  
  @param objectName {@link ObjectName} where the MBean is registered
  @param mBeanServer {@link MBeanServer} from which to unregister the MBean.
  @throws Exception If unregistration could not be completed.