Stop the bean instance specified by the beanName. ManagedContainer
wrapper around uninstallBean
495923
public void stopBean(BeanMetaData bmd) throws CSIException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "stopBean : " + bmd.j2eeName);

        try {
            uninstallBean(bmd, false);
        } catch (Throwable ex) {
            FFDCFilter.processException(ex, CLASS_NAME + ".stopBean", "876", this);
            throw new CSIException("Stop on bean " + bmd.j2eeName + " failed", ex);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "stopBean");
    }
635745
protected void deactivate(ComponentContext context) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "MongoService deactivate");
        }

        try {
            closeMongoClient();
            if (sslHelper != null) {
                sslHelper.removeChangeListener(this);
            }
        } finally {
            libraryRef.deactivate(context);
            sslConfigurationRef.deactivate(context);
            keyStoreServiceRef.deactivate(context);
        }
    }
555828
public void destroy() {
        XmlWebApplicationContext wac = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(_context);
        if (wac != null) {
            _context.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        } else {
            _logger.warning("Nothing more to destroy");
            return;
        }

        _logger.info("<<<< Service Platform(" + _application + ") destruction starting");
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        while (!_manageables.empty()) {
            ObjectName on = _manageables.pop();
            _logger.info("<<<<<<<< MBean(" + on + ") unregistration starting");
            try {
                mbs.unregisterMBean(on);
            } catch (Exception x) {
                _logger.log(Level.WARNING, on.toString());
            }
            _logger.info("<<<<<<<< MBean(" + on + ") unregistration complete");
        }
        while (!_plca.empty()) {
            List<Pair<String, PlatformAware>> plcas = _plca.pop();
            for (Pair<String, PlatformAware> plca: plcas) {
                _logger.info("<<<<<<<< PlatformAware(" + plca.first + '/' + plca.second.getClass().getName() + ") termination starting");
                plca.second.terminate(_application, plca.first);
                _logger.info("<<<<<<<< PlatformAware(" + plca.first + '/' + plca.second.getClass().getName() + ") termination complete");
            }
        }

        // finally, deregisters JDBC driver manually to prevent Tomcat 7 from complaining about memory leaks
        Enumeration<java.sql.Driver> drivers = java.sql.DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            java.sql.Driver driver = drivers.nextElement();
            _logger.info("<<<<<<<< JDBC Driver(" + driver + ") deregistration starting");
            try {
                java.sql.DriverManager.deregisterDriver(driver);
            } catch (java.sql.SQLException x) {
                _logger.log(Level.WARNING, "Error deregistering driver " + driver, x);
            }
            _logger.info("<<<<<<<< JDBC Driver(" + driver + ") deregistration complete");
        }

        for (Iterator<String> it = _registry.keySet().iterator(); it.hasNext();) {
            if (!it.next().startsWith("x!/")) it.remove();
        }
        _registry.remove("x!/ping");
        _registry.remove("x!/list");
        _registry.remove("x!/desc");
        while (!_applc.empty()) {
            _applc.pop().close();
        }
        wac.close();

        _logger.info("<<<< Service Platform(" + _application + ") destruction complete");
    }
890121
@Override
    public synchronized BeanContext stop() {
        if (terminating.compareAndSet(false, true)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Stopping BeanContext");
            }
            publishEvent(new ShutdownEvent(this));

            // need to sort registered singletons so that beans with that require other beans appear first
            List<BeanRegistration> objects = topologicalSort(singletonObjects.values());

            Set<Integer> processed = new HashSet<>();
            for (BeanRegistration beanRegistration : objects) {
                BeanDefinition def = beanRegistration.beanDefinition;
                Object bean = beanRegistration.bean;
                int sysId = System.identityHashCode(bean);
                if (processed.contains(sysId)) {
                    continue;
                }

                if (LOG_LIFECYCLE.isDebugEnabled()) {
                    LOG_LIFECYCLE.debug("Destroying bean [{}] with identifier [{}]", bean, beanRegistration.identifier);
                }

                processed.add(sysId);
                if (def instanceof DisposableBeanDefinition) {
                    try {
                        //noinspection unchecked
                        ((DisposableBeanDefinition) def).dispose(this, bean);
                    } catch (Throwable e) {
                        if (LOG.isErrorEnabled()) {
                            LOG.error("Error disposing of bean registration [" + def.getName() + "]: " + e.getMessage(), e);
                        }
                    }
                }
                if (def instanceof Closeable) {
                    try {
                        ((Closeable) def).close();
                    } catch (Throwable e) {
                        if (LOG.isErrorEnabled()) {
                            LOG.error("Error disposing of bean registration [" + def.getName() + "]: " + e.getMessage(), e);
                        }
                    }
                }
                if (bean instanceof LifeCycle) {
                    ((LifeCycle) bean).stop();
                }
            }

            terminating.set(false);
            running.set(false);
            ClassLoadingReporter.finish();
        }
        return this;
    }
1205718
private void stop(final ResourceInstanceEntity instance)
	{
		azure.stop(instance);

		instance.setState(ResourceInstanceState.DISCARDING);
	}
676694
public void cleanup() {
        managers.clear();
        for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) {
            beanManager.cleanup();
        }
        beanDeploymentArchives.clear();
        deploymentServices.cleanup();
        deploymentManager.cleanup();
        instance.clear(contextId);
    }
959609
public void removeBean(BeanO beanO) throws CSITransactionRolledbackException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "removeBean with BeanO");

        //------------------------------------------------------------------------
        // If bean id is null then beanO could not have been added to this
        // container. Also, if beanO is not enlisted in the tran, then it either
        // was never added to this container, or it was added, but already
        // removed.  This may occur for example in the case of a
        // DuplicateKeyException.                                 dPQ51806 d145697
        //------------------------------------------------------------------------

        BeanId id = beanO.getId();

        if (id != null) {
            try {
                // If this particular BeanO was enlisted, then it needs to be
                // removed from the tran and the ejb cache.                  d145697
                ContainerTx currentTx = getCurrentTx(false); //d171654 // d139352-2
                if (currentTx.delist(beanO)) {
                    activator.removeBean(currentTx, beanO);
                } else {
                    // This is normal, it just means the failure occurred early in
                    // the create proccess, before the bean was ever enlisted or
                    // added to the EJB Cache.                                d145697
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "BeanO not enlisted - not removed from tx or cache");
                }
            } catch (Throwable th) {
                // The transaction may have already rolled back.             d145697
                FFDCFilter.processException(th, CLASS_NAME + ".removeBean(BeanO)",
                                            "1949", this);
                if (isTraceOn && tc.isEventEnabled())
                    Tr.event(tc, "Exception thrown in removeBean()",
                             new Object[] { beanO, th });
            }
        } else {
            // This is normal, it just means the failure occurred early in
            // the create proccess, before the bean was ever enlisted or
            // added to the EJB Cache.                                      d145697
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "BeanId is null");
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "removeBean");
    }
1129885
public void stop() throws Exception {

		if( this.nazgulAgentFactory != null ) {
			for( ComponentInstance nazgul : this.nazgulAgentFactory.getInstances())
				deleteIPojoInstance( nazgul );
		}

		if( this.standardAgentFactory != null ) {
			for( ComponentInstance agent : this.standardAgentFactory.getInstances())
				deleteIPojoInstance( agent );
		}
	}
522853
public void destroy(String name, Object instance)
    {
        if (instance != null && isManagedBean(name))
        {
            try
            {
                _lifecycleProvider.destroyInstance(instance);
            } 
            catch (IllegalAccessException e)
            {
                log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e);
            } 
            catch (InvocationTargetException e)
            {
                log.log(Level.SEVERE, "An Exception occured while invoking " +
                        "@PreDestroy method of managed bean " + name, e);
            }
        }
    }
141183
void stop( Instance instance, PluginInterface plugin ) throws IOException {

		String instancePath = InstanceHelpers.computeInstancePath( instance );
		if( instance.getStatus() != InstanceStatus.DEPLOYED_STARTED )
			this.logger.fine( instancePath + " cannot be stopped. Prerequisite status: DEPLOYED_STARTED (but was " + instance.getStatus() + ")." );
		else
			stopInstance( instance, plugin, false );
	}
356187
protected void deactivate(ComponentContext context) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "deactivate", name);

        lock.writeLock().lock();
        try {
            if (pmMBean != null) {
                pmMBean.unregister();
                pmMBean = null;
            }
            pm = null;
            properties = null;
        } finally {
            lock.writeLock().unlock();
        }

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "deactivate");
    }
816650
def stop(self):
        
        LOGGER.debug("InjectorService.stop")
        self.driver.stop()
        InjectorUITreeService.requester = None
        InjectorCachedRegistryFactoryService.requester = None
        InjectorCachedComponentService.requester = None
        InjectorCachedGearService.requester = None
125103
public boolean unregisterMBean(String name) throws MBeanRegistrationException {

        synchronized (mBeanServer) {

            ObjectName toRemoveName;

            try {
                toRemoveName = new ObjectName(name);
            } catch (MalformedObjectNameException e) {
                return false; // bean with malformed can not be registered.
            }

            beansNames.remove(toRemoveName);

            try {
                mBeanServer.unregisterMBean(toRemoveName);
                return true;
            } catch (InstanceNotFoundException e) {
                return false;
            }

        }

    }
30263
@PreDestroy
    public void stop() throws Exception {
        JmxUtils2.unregisterObject(queryMbeanObjectName, embeddedJmxTrans.getMbeanServer());

        for (OutputWriter outputWriter : outputWriters) {
            outputWriter.stop();
        }
    }
675872
@Override
	public void postProcessBeforeDestruction(final Object bean, final String beanName) throws BeansException {
		if (subscribers.containsKey(beanName)) {
			Subscribe annotation = getAnnotation(bean.getClass(), beanName);
			LOG.debug("Unsubscribing the event listener '{}' from event bus '{}' with topic '{}", beanName,
					annotation.eventBus(), annotation.topic());
			try {
				EventBus eventBus = getEventBus(annotation.eventBus(), beanName);
				eventBus.unsubscribe(annotation.topic(), (EventSubscriber) bean);
			} catch (Exception e) {
				LOG.error("Unsubscribing the event listener '{}' failed", beanName, e);
			} finally {
				subscribers.remove(beanName);
			}
		}
	}
806826
protected void deactivate(ComponentContext context) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "deactivate");

        lock.writeLock().lock();
        try {
            if (isInitialized) {
                if (classloader != null) {
                    if (isDerbyEmbedded.get())
                        shutdownDerbyEmbedded();
                    classloader = null;
                }
                for (Iterator<Class<? extends CommonDataSource>> it = introspectedClasses.iterator(); it.hasNext(); it.remove())
                    Introspector.flushFromCaches(it.next());
                isInitialized = false;
            }
        } finally {
            lock.writeLock().unlock();
        }

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "deactivate");
    }
964175
private void stopProcessEngine(String serviceName, PlatformServiceContainer serviceContainer) {

    try {
      serviceContainer.stopService(serviceName);
    }
    catch(Exception e) {
      LOG.exceptionWhileStopping("Process Engine", serviceName, e);
    }

  }