code: public static void unregisterMbean(ObjectName name) {
          try {
              ManagementFactory.getPlatformMBeanServer().unregisterMBean(name);
          } catch(Exception e) {
              logger.error("Error unregistering mbean", e);
          }
      }
docs: Unregister the mbean with the given name from the platform mbean server
  
  @param name The name of the mbean to unregister