For each registered MBean, unpublish, unregister and remove from the map.
336726
private void destroyEndpointMBeans() {
        for (Map.Entry<String, ServiceRegistration<DynamicMBean>> mbean : endpointMBeans.entrySet()) {
            String mbeanName = mbean.getKey();
            endpointMBeans.remove(mbeanName);
            mbean.getValue().unregister();
        }
    }
99939
public void deregister() {
		if(objectName == null) {
			return;
		}
		
		try {
			MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
			if (mbs.isRegistered(objectName)) {
				mbs.unregisterMBean(objectName);
			}
			objectName = null;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
755728
@Invalidate
    public void stop(){
        for(ServiceRegistration registration: registrations){
            registration.unregister();
        }
        registrations.clear();
        names.clear();
    }
1337138
public synchronized void unregisterThrow(Object obj) throws JMException {
		if (obj instanceof PublishAllBeanWrapper) {
			unregisterThrow(ObjectNameUtil.makeObjectName(((PublishAllBeanWrapper) obj).getJmxResourceInfo()));
		} else {
			unregisterThrow(ObjectNameUtil.makeObjectName(obj));
		}
	}
204559
def __unregister_services(self):
        
        # Copy the services list, as it will be modified during the process
        with self.__registration_lock:
            registered_services = self.__registered_services.copy()

        for registration in registered_services:
            try:
                registration.unregister()
            except BundleException:
                # Ignore errors at this level
                pass

        if self.__registered_services:
            _logger.warning("Not all services have been unregistered...")

        with self.__registration_lock:
            # Clear the list, just to be clean
            self.__registered_services.clear()
1058066
public void unregisterMBean(final ObjectName name) throws JMException {
    if ((beanServer != null) &&
        beanServer.isRegistered(name) &&
        registeredMBeanNames.remove(name)) {
      beanServer.unregisterMBean(name);
    }
  }
1350732
public void unregisterMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
      log.trace("Unregistering jmx resources..");
      try {
         for (ResourceDMBean resource : resourceDMBeans) {
            JmxUtil.unregisterMBean(getObjectName(resource), mBeanServer);
         }
      }
      catch (Exception e) {
         throw new CacheException("Failure while unregistering mbeans", e);
      }
   }
522955
private function unregister() {
        if ($this->db) {
            $this->db->recordset_closed($this);
            $this->db = null;
        }
    }
813748
static void unregister(Object value) {
        if (value != null) {
            Map<Object, Object> m = getRegistry();
            if (m != null) {
                m.remove(value);
                if (m.isEmpty()) {
                    REGISTRY.remove();
                }
            }
        }
    }
321075
function() {

        //clear out layers info and unregister their events
        this.clearLayersArray("base");
        this.clearLayersArray("data");

        this.map.events.un({
            buttonclick: this.onButtonClick,
            addlayer: this.redraw,
            changelayer: this.redraw,
            removelayer: this.redraw,
            changebaselayer: this.redraw,
            scope: this
        });
        this.events.unregister("buttonclick", this, this.onButtonClick);

        OpenLayers.Control.prototype.destroy.apply(this, arguments);
    }
851868
public synchronized void unregister() {
        if (this.service != null) {
            LOG.info("unregister servlet on mountpoint {} with contextParams {}", getAlias(),
                contextParams);
            this.service.unregister(getAlias());
            this.service = null;
        }
    }
147506
@Invalidate
    public void stop() {
        for (ServiceRegistration<Template> reg : registrations.values()) {
            try {
                reg.unregister();
            } catch (Exception e) { //NOSONAR
                // Ignore it.
            }
        }
        registrations.clear();
    }
906693
public void unregister() {
    context.unregisterReceiver(networkConnectionChangeReceiver);
    context.unregisterReceiver(internetConnectionChangeReceiver);
    if (wifiAccessPointsScanEnabled) {
      context.unregisterReceiver(wifiSignalStrengthChangeReceiver);
    }
  }
341639
public void destroy() {
        for (int j = 0; j < mApplications.length; j++) {
            if (mApplications[j] != null) {
                mApplications[j].destroy();
            }
        }
    }
1051758
void removeAllEventListeners() {
        for (JcrListenerAdapter adapter : this.listeners) {
            assert (adapter != null);
            this.repositoryObservable.unregister(adapter);
        }
        this.listeners.clear();
    }
868552
@VisibleForTesting
  public static void unregister(PropertyKey key) {
    String name = key.getName();
    DEFAULT_KEYS_MAP.remove(name);
    DEFAULT_ALIAS_MAP.remove(name);
  }
840097
public void purge() {
        long time = System.currentTimeMillis();
        if (time - latestWriteTime > expireMillis) {
            // Everything in the map is expired, clear all at once
            map.clear();
        } else {
            // Iterate and remove until the first non-expired token
            Iterator<Value> values = map.values().iterator();
            while (values.hasNext()) {
                if (time >= values.next().expire) {
                    values.remove();
                } else {
                    break;
                }
            }
        }
    }