Unregister a MBean from JMX server. Errors are ignored and logged as warnings.
321033
public static void unregister(String name) {
    try {
      ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name));
    } catch (Exception e) {
      LoggerFactory.getLogger(Jmx.class).warn("Can not unregister MBean [{}]", name, e);
    }
  }
781824
private int unregisterHandles() {
        int cancelledHandles = 0;
        for (;;) {
            AcceptorOperationFuture future = cancelQueue.poll();
            if (future == null) {
                break;
            }

            // close the channels
            for (SocketAddress a : future.getLocalAddresses()) {
                H handle = boundHandles.remove(a);
                
                if (handle == null) {
                    continue;
                }

                try {
                    close(handle);
                    wakeup(); // wake up again to trigger thread death
                } catch (Throwable e) {
                    ExceptionMonitor.getInstance().exceptionCaught(e);
                } finally {
                    cancelledHandles++;
                }
            }

            future.setDone();
        }

        return cancelledHandles;
    }
738362
def UnregisterMessageHandler(self, timeout=None):
    """"""
    if self.handler_thread:
      self.handler_stop = True
      self.handler_thread.join(timeout)
      if self.handler_thread.isAlive():
        raise RuntimeError("Message handler thread did not join in time.")
      self.handler_thread = None
906693
public void unregister() {
    context.unregisterReceiver(networkConnectionChangeReceiver);
    context.unregisterReceiver(internetConnectionChangeReceiver);
    if (wifiAccessPointsScanEnabled) {
      context.unregisterReceiver(wifiSignalStrengthChangeReceiver);
    }
  }
1061680
def unregister_all(self):
        
        aliases = list(self._service_objects.keys())
        for alias in aliases:
            self.unregister(alias)
454633
@Override
  public void unregister(Monitor<?> monitor) {
    try {
      List<MonitorMBean> beans = MonitorMBean.createMBeans(name, monitor, mapper);
      for (MonitorMBean bean : beans) {
        try {
          mBeanServer.unregisterMBean(bean.getObjectName());
          locks.remove(bean.getObjectName());
        } catch (InstanceNotFoundException ignored) {
          // ignore errors attempting to unregister a non-registered monitor
          // a common error is to unregister twice
        }
      }
      monitors.remove(monitor.getConfig());
      updatePending.set(true);
    } catch (Exception e) {
      LOG.warn("Unable to un-register Monitor:" + monitor.getConfig(), e);
    }
  }
1251612
public static function unregisterInstance(): void
    {
        if (!self::$unregistering && self::$client !== null) {
            self::$unregistering = true;

            if ((self::$client->preparedToSendBuffer ?: '') !== '') {
                self::$client->sendBuffer .= self::$client->preparedToSendBuffer;
            }

            try {
                self::$client->sendBuffer .= self::$client->protocol->getKeepAlive();
                self::$client->protocol->flush();
            } catch (\Throwable $e) {
            }

            // TODO MUST TEST, IT WAS REMOVED FROM FUNCTION
            // BECAUSE IT SIMPLY LOOKS LIKE THE LINES BEFORE
            // ADDED AN IF TO CHECK THE CHANNEL In CASE OF
            //
            if (isset(self::$client->protocol->handler->channel) &&
                false === strpos(get_class(self::getClient()->protocol->handler->channel), '/EmptyChannel/')) {
                try {
                    self::$client->protocol->keepAlive();
                } catch (\Throwable $e) {
                    // silently discard exceptions when unregistering
                }
            }

            self::$client = null;
            self::$instance = null;
            self::$instanceOptionsKey = null;
            self::$unregistering = false;
        }
    }
168759
def unregister(cls, plugin):
        
        plugs = getattr(cls, '_%s__plugins' % cls.__name__, {})
        try:
            plugs.pop(plugin.name())
        except AttributeError:
            pass
        except ValueError:
            pass
980368
public static void unregisterMXBean(CacheProxy<?, ?> cache, MBeanType type) {
    ObjectName objectName = getObjectName(cache, type);
    unregister(objectName);
  }
515672
private void rebuildJmx()
    {
        m_mbeanServer = ManagementFactory.getPlatformMBeanServer();

        try
        {
            buildMBeanInfo();

            //
            //  Remove and reinstall from the MBean registry if it already exists.  Also
            //  remove previous instances.
            //
            ObjectName newName = getJMXName();

            if( m_mbeanServer.isRegistered(newName) )
            {
                log.debug("Removing already registered bean {}", newName);
                m_mbeanServer.unregisterMBean(newName);
            }

            if( m_jmxName != null && !newName.equals(m_jmxName) && m_mbeanServer.isRegistered(m_jmxName) )
            {
                log.debug("Removing the old bean {}", m_jmxName);
                m_mbeanServer.unregisterMBean(m_jmxName);
            }

            m_jmxName = getJMXName();

            if( m_beanInfo != null )
            {
                m_mbeanServer.registerMBean( this, m_jmxName );

                log.debug("Registered new JMX bean '{}'", m_jmxName);
            }
        }
        catch (InstanceAlreadyExistsException e)
        {
            log.debug("JMX bean '{}' already registered, continuing...");
        }
        catch (Exception e)
        {
            throw new ConfigurationException(e);
        }
    }
519727
protected void registerUnregisterJMX(boolean doRegister) {
		if (this.mbs == null ){ // this way makes it easier for mocking.
			this.mbs = ManagementFactory.getPlatformMBeanServer();
		}
		try {
			String suffix = "";

			if (this.config.getPoolName()!=null){
				suffix="-"+this.config.getPoolName();
			}

			ObjectName name = new ObjectName(MBEAN_BONECP +suffix);
			ObjectName configname = new ObjectName(MBEAN_CONFIG + suffix);


			if (doRegister){
				if (!this.mbs.isRegistered(name)){
					this.mbs.registerMBean(this.statistics, name);
				}
				if (!this.mbs.isRegistered(configname)){
					this.mbs.registerMBean(this.config, configname);
				}
			} else {
				if (this.mbs.isRegistered(name)){
					this.mbs.unregisterMBean(name);
				}
				if (this.mbs.isRegistered(configname)){
					this.mbs.unregisterMBean(configname);
				}
			}
		} catch (Exception e) {
			logger.error("Unable to start/stop JMX", e);
		}
	}
1082951
protected void unregisterNotificationListeners(ClassLoaderLeakPreventor preventor, NotificationBroadcasterSupport mBean,
                                                 final Class<?> listenerWrapperClass) {
    final Field listenerListField = preventor.findField(NotificationBroadcasterSupport.class, "listenerList");
    if(listenerListField != null) {
      final Class<?> listenerInfoClass = preventor.findClass("javax.management.NotificationBroadcasterSupport$ListenerInfo");

      final List<? /*javax.management.NotificationBroadcasterSupport.ListenerInfo*/> listenerList =
          preventor.getFieldValue(listenerListField, mBean);

      if(listenerList != null) {
        final Field listenerField = preventor.findField(listenerInfoClass, "listener");
        final Field filterField = preventor.findField(listenerInfoClass, "filter");
        final Field handbackField = preventor.findField(listenerInfoClass, "handback");
        for(Object listenerInfo : listenerList) {
          final NotificationListener listener = preventor.getFieldValue(listenerField, listenerInfo);
          final NotificationListener rawListener = unwrap(preventor, listenerWrapperClass, listener);
          final NotificationFilter filter = preventor.getFieldValue(filterField, listenerInfo);
          final Object handback = preventor.getFieldValue(handbackField, listenerInfo);
          
          if(preventor.isLoadedInClassLoader(rawListener) || preventor.isLoadedInClassLoader(filter) || preventor.isLoadedInClassLoader(handback)) {
            preventor.warn(((listener == rawListener) ? "Listener '" : "Wrapped listener '") + listener + 
                "' (or its filter or handback) of MBean " + mBean + 
                " was loaded in protected ClassLoader; removing");
            // This is safe, as the implementation works with a copy, not altering the original
            try {
              mBean.removeNotificationListener(listener, filter, handback);
            }
            catch (ListenerNotFoundException e) { // Should never happen
              preventor.error(e);
            }
          }
        }
      }
    }
  }
96821
@Override
	public void unregisterIrObs(IREventObserver obs)
	{
		if (obs != null && irObserver == obs)
		{
			irObserver = null;
		}
	}
475156
def unregister(self, name):
        
        try:
            name = name.name
        except AttributeError:
            pass
        return self.pop(name,None)
428408
def unregister(*args, &block)
      h = Unobservable.handler_for(*args, &block)
      index = @handlers.index(h)
      if index
        @handlers.slice!(index)
        return h
      else
        return nil
      end
    end
1215663
def unregister(model_or_iterable, fail_silently=False):
    '''
    
    '''
    from django.db import models
    from .compat import get_model

    if issubclass(model_or_iterable, models.Model):
        model_or_iterable = [model_or_iterable]
    for model in model_or_iterable:
        if isinstance(model, string_types):
            model = get_model(*model.split('.', 1))
        try:
            del REGISTRY[model]
        except KeyError:
            if fail_silently:
                continue
            raise ValueError(
                u'The model %s.%s is not registered.' % (
                    model._meta.app_label,
                    model._meta.object_name,
                ))
1088736
private void unregisterJmxExpose() {
		if (jmxNames.isEmpty()) {
			return;
		}
		try {
			final MBeanServer platformMBeanServer = MBeans.getPlatformMBeanServer();
			for (final ObjectName name : jmxNames) {
				platformMBeanServer.unregisterMBean(name);
			}
		} catch (final JMException e) {
			LOG.warn("failed to unregister JMX beans", e);
		}
	}