Un-registers the bean from the JMX server.
12519
public void stop() {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName beanName = null;
        try {
            beanName = getObjectName();
            server.unregisterMBean(beanName);
        } catch (InstanceNotFoundException e) {
            LOGGER.debug("JMX bean {0} not found", beanName);
        } catch (Exception e) {
            LOGGER.error(e, JcrI18n.cannotUnRegisterMBean, beanName);
        }
    }
773064
public boolean unregister(BeanId beanId, boolean dropRef) // f111627
    throws CSIException
    {
        boolean removed = false;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "unregister",
                     new Object[] { beanId, new Boolean(dropRef) }); // d181569

        ByteArray wrapperKey = beanId.getByteArray(); // d181569

        try
        {
            EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) // f111627
            wrapperCache.removeAndDiscard(wrapperKey, dropRef);
            if (wrapperCommon != null) { // f111627
                removed = true;
            }
        } catch (IllegalOperationException ex)
        {
            // Object is pinned and cannot be removed from the cache
            // Swallow the exception for now, and let the Eviction thread
            // take care of the object later
            FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "351", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { // d144064
                Tr.event(tc,
                         "unregister ignoring IllegalOperationException for object "
                                         + beanId); // d181569
                Tr.event(tc, "Exception: " + ex);
            }
        } catch (DiscardException ex)
        {
            FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "358", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) // d144064
                Tr.event(tc, "Unable to discard element");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "unregister");

        return removed;
    }
101810
public void dispose() {
        synchronized (this) {
            if (serviceRegistration == null) {
                throw new IllegalStateException(String.format("%s [%s] had not been registered.", getClass()
                    .getSimpleName(), this));
            }
            serviceRegistration.unregister();
            serviceRegistration = null;
        }
    }
151685
public void close() {
        synchronized(factory.cnxns){
            // if this is not in cnxns then it's already closed
            if (!factory.cnxns.remove(this)) {
                return;
            }

            synchronized (factory.ipMap) {
                Set<NIOServerCnxn> s =
                    factory.ipMap.get(sock.socket().getInetAddress());
                s.remove(this);
            }

            // unregister from JMX
            try {
                if(jmxConnectionBean != null){
                    MBeanRegistry.getInstance().unregister(jmxConnectionBean);
                }
            } catch (Exception e) {
                LOG.warn("Failed to unregister with JMX", e);
            }
            jmxConnectionBean = null;

            if (zk != null) {
                zk.removeCnxn(this);
            }

            closeSock();

            if (sk != null) {
                try {
                    // need to cancel this selection key from the selector
                    sk.cancel();
                } catch (Exception e) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("ignoring exception during selectionkey cancel", e);
                    }
                }
            }
        }
    }
630206
@Unbind
    public void unbindFactory(Factory factory) {
        try {
            lock.lock();
            InstanceDeclaration declaration = getDeclarationByFactory(factory);
            if (declaration != null) {
                LOGGER.info("Disposing instance created by");
                declaration.dispose();
                declarations.remove(declaration);
            }
        } finally {
            lock.unlock();
        }
    }
94152
@Override
  public void unregister(final Identifier id) throws IOException {
    final Link<NamingMessage> link = transport.open(serverSocketAddr, codec,
        new LoggingLinkListener<NamingMessage>());
    link.write(new NamingUnregisterRequest(id));
  }
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();
                }
            }
        }
    }
275046
public void unregister(EventObserver<?> observer){
        for (Map.Entry<Class, Set<EventObserver>> entry : observers.entrySet()) {
            entry.getValue().remove(observer);
        }

    }
263947
def _unregister_service(self):
        
        if self._registration is not None:
            # Ignore error
            try:
                self._registration.unregister()
            except BundleException as ex:
                # Only log the error at this level
                logger = logging.getLogger(
                    "-".join((self._ipopo_instance.name, "ServiceRegistration"))
                )
                logger.error("Error unregistering a service: %s", ex)

            # Notify the component (even in case of error)
            self._ipopo_instance.safe_callback(
                ipopo_constants.IPOPO_CALLBACK_POST_UNREGISTRATION,
                self._svc_reference,
            )

            self._registration = None
            self._svc_reference = None
897516
@PreDestroy
    public final void dispose() {
        getConnectionPool().ifPresent(PoolResources::dispose);
        getThreadPool().dispose();

        try {
            ObjectName name = getByteBufAllocatorObjectName();

            if (ManagementFactory.getPlatformMBeanServer().isRegistered(name)) {
                ManagementFactory.getPlatformMBeanServer().unregisterMBean(name);
            }
        } catch (JMException e) {
            this.logger.error("Unable to register ByteBufAllocator MBean", e);
        }
    }
914662
public void destroy() {
        JmsUtils.closeSession(session);

        if (connection != null) {
            ConnectionFactoryUtils.releaseConnection(connection, endpointConfiguration.getConnectionFactory(), true);
        }
    }
755728
@Invalidate
    public void stop(){
        for(ServiceRegistration registration: registrations){
            registration.unregister();
        }
        registrations.clear();
        names.clear();
    }
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;
        }
    }
739862
ServerSessionContext unregisterSession(long sessionId) {
    ServerSessionContext session = sessions.remove(sessionId);
    if (session != null) {
      clients.remove(session.client(), session);
      connections.remove(session.client(), session.getConnection());
    }
    return session;
  }
1329339
public static function unregister()
    {
        self::$registered = false;
        in_array(vfsStream::SCHEME, stream_get_wrappers()) and
            stream_wrapper_unregister(vfsStream::SCHEME);
    }
413543
public void shutdown() {
    if (mbeanName != null) {
      MBeanUtil.unregisterMBean(mbeanName);
    }
    if (versionBeanName != null) {
      MBeanUtil.unregisterMBean(versionBeanName);
    }
    if (namenodeMXBeanName != null) {
      MBeanUtil.unregisterMBean(namenodeMXBeanName);
    }
  }
620900
public void destroy() {
        DeferredBindingActions.clear();
        if(!disconnected.isEmpty()) {
            disconnected.pop();
        }
        if (getSessionFactory() == null || decNestingCount() > 0 || getParticipate()) {
            return;
        }

        // single session mode
        SessionHolder holder = (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
        LOG.debug("Closing single Hibernate session in GrailsDispatcherServlet");
        try {
            disconnected.clear();
            SessionFactoryUtils.closeSession(holder.getSession());
        }
        catch (RuntimeException ex) {
            LOG.error("Unexpected exception on closing Hibernate Session", ex);
        }
    }