Unloads the platform.

<p>If this method is never called, all application contexts will be unloaded when the servlet context is destroyed.</p>
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");
    }
406477
public synchronized void destroyed(AppContextWrapper context) {
		try {
			ContainerRegistryBuilder cb = (ContainerRegistryBuilder) context
					.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			if (cb != null) {
				ContainerDirector cd = new ContainerDirector(cb);
				cd.shutdown();
				context.removeAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
				containerBuilderContext = null;
				// context.removeAttribute(ContainerBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
				Debug.logVerbose("[JdonFramework] stop the container ..", module);
			}
		} catch (Exception e) {
			Debug.logError("[JdonFramework] destroyed error: " + e, module);
		}

	}
326348
public void destroySession() {
		if (entryPoint != null) {
			entryPoint.onSessionDestruction(this, session);
		}
		if (accessManager != null) {
			accessManager.destroyCurrentSession();
		}
		session = null;
	}
610205
@SuppressWarnings("unchecked")
  public final E remove()
  {
    Thread thread = Thread.currentThread();
    ClassLoader loader = thread.getContextClassLoader();

    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;

        return (E) envLoader.removeAttribute(_varName);
      }
    }

    return setGlobal(null);
  }
864301
@Override
    public void close() throws Exception {
        unbindAll();
        initialContext.destroySubcontext("java:/comp/env/jdbc");
        initialContext.destroySubcontext("java:/comp/env");
        initialContext.destroySubcontext("java:/comp");
        initialContext.destroySubcontext("java:");
        initialContext.close();
    }
702520
@Override
	public void destroy() {
		try {
			ContextClassLoaderUtils.doWithClassLoader(jasperClassLoader,
					new Callable<Void>() {

						@Override
						public Void call() throws Exception {
							jasperServlet.destroy();
							return null;
						}

					});
			//CHECKSTYLE:OFF
		} catch (Exception ignore) {
			// ignored as it should never happen
			LOG.error("Ignored exception", ignore);
		}
		//CHECKSTYLE:ON
	}
192708
protected synchronized void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Unregistering JNDIEntry " + serviceRegistration);
        }
        if (this.serviceRegistration != null) {
            this.serviceRegistration.unregister();
        }
    }
1197406
private static void cleanup(ContextFromVertx context) {
        // Release all resources, especially uploaded file.
        if (context != null) {
            context.cleanup();
        }
        Context.CONTEXT.remove();
    }
491878
public void unsetResourceAdaptorContext() {
		this.raContext = null;
		this.tracer = null;
		this.sleeEndpoint = null;
		this.eventLookupFacility = null;
		this.sbbInterface = null;		
	}
335552
public void contextDestroyed(ServletContextEvent arg0) {
		Iterator<Driver> drivers = DriverManager.getDrivers();
		while (drivers.hasNext()) {
			Driver driver = drivers.next();
			DriverManager.deregisterDriver(driver);
			DriverImpl impl = (DriverImpl) driver;
			impl.shutdown();
		}
	}
469357
private synchronized void unloadSources() {
        nodesSourceList = new ArrayList<>();
        Closeables.closeQuietly(nodeSourceReferences);
        nodeSourceReferences = new HashSet<>();
        sourcesOpened = false;
    }
817460
public void dispose() {
		singleton.clear();
		components.clear();
		pointcuts.clear();
		contexts.clear();
		instances.clear();
	}
1094890
public void unbindService() {
        Log.v(TAG, "Trying to unbind the service");
        Context context = this.context.get();
        if (isBound && context != null) {
            context.unbindService(this);
            isBound = false;
        }
    }
1146858
public void stop() throws Throwable
   {
      Context context = new InitialContext();

      context.unbind(JNDI_NAME);

      context.close();
   }
993210
public void unsetSbbContext() {
		this.sbbContext = null;
		this.tracer = null;
		this.timerFacility = null;
		this.nullACIFactory = null;
		this.nullActivityFactory = null;
		this.sipProvider = null;
	}
495596
@Override
    public void contextDestroyed(ServletContextEvent event) {
        // deregister database drivers
        try {
            for (Enumeration<Driver> e = DriverManager.getDrivers(); e
                    .hasMoreElements();) {
                Driver driver = e.nextElement();
                if (driver.getClass().getClassLoader() == getClass()
                        .getClassLoader()) {
                    DriverManager.deregisterDriver(driver);
                }
            }
        } catch (Throwable e) {
            // Any errors thrown in clearing the caches aren't significant to
            // the normal execution of the application, so we ignore them
        }
        // Clean the axis method cache, see FCREPO-496
//        org.apache.axis.utils.cache.MethodCache.getInstance().clearCache();
    }
835961
public static void unload() {
        if(elements != null) {
            for (Element style : elements) {
                style.removeFromParent();
            }
            elements.clear();
        }
    }