code: public void cleanup(){
  
          synchronized (mBeanServer) {
  
              for (ObjectName beanName : beansNames)
                  try {
                      mBeanServer.unregisterMBean(beanName);
                  } catch (InstanceNotFoundException ignored) {
                      // Bean previously been unregistered
                  } catch (MBeanRegistrationException e) {
                      log.warn("Exception thrown while trying to clean up registered MBeans", e);
                  }
  
          }
  
      }
docs: Unregisters all beans, that been registered by this utility object.