code: private void unregisterMBeanInService(String name) {
          ServiceRegistration<DynamicMBean> existingMBean = endpointMBeans.remove(name);
          if (existingMBean != null) {
              existingMBean.unregister();
          }
      }
docs: Remove the MBean from the map of registered MBeans and unregister it.
  
  @param name endpoint name of the mbean to be unregistered