code: public Map<String, Exception> unexportAllAndReportMissing()
      {
          Map<String, Exception> errors = new HashMap<>();
  
          synchronized(exportedObjects) {
              List<ObjectName> toRemove = new ArrayList<>(exportedObjects.size());
              for (ObjectName objectName : exportedObjects.keySet()) {
                  try {
                      server.unregisterMBean(objectName);
                      toRemove.add(objectName);
                  }
                  catch(InstanceNotFoundException e) {
                      // ignore ... mbean has already been unregistered elsewhere
                      toRemove.add(objectName);
                  }
                  catch (MBeanRegistrationException e) {
                      //noinspection ThrowableResultOfMethodCallIgnored
                      errors.put(objectName.toString(), e);
                  }
              }
  
              exportedObjects.keySet().removeAll(toRemove);
          }
  
          return errors;
      }
docs: Unexports all MBeans that have been exported through this MBeanExporter.
  
  @return a map of object names that could not be exported and the corresponding exception.