Shuts down the application in Web environment and deassociates the
current {@code ServletContext} from {@link Application} context.

@param sce The event the {@code ServletContext} is destroyed.
348947
@SuppressWarnings("unchecked")
	public void contextDestroyed(ServletContextEvent sce) {
		WebContext<ServletContext> context = (WebContext<ServletContext>) container.component(container.contexts().get(Application.class));
		context.deassociate(sce.getServletContext());
		
		synchronized (Jaguar.class) {
			if (running()) {
				shutdown();
			}
		}
	}
1049480
public void setContext( AdapterContext context )
    {
        Object servletContext = context.getExternalContext();
        assert servletContext instanceof ServletContext : servletContext;
        _servletContext = ( ServletContext ) servletContext;
        _eventReporter = createEventReporter();
    }
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();
        }
    }
341826
public static void close(Session session) {
		if (session != null && session.isConnected()) {
			session.disconnect();
		}
		JschSessionPool.INSTANCE.remove(session);
	}
204004
public void removeBeanContextServicesListener(BeanContextServicesListener listener)
	{
		if (listener == null)
		{
			throw new NullPointerException();
		}
		synchronized (bcsListeners)
		{
			bcsListeners.remove(listener);
		}
	}
900774
public void stop(BundleContext context) throws Exception {
        if (!checkConfig(context)) {
            return;
        }

        if (monitoringService == null) {
            initWsClient(context);
        }

        EventType serverStopEvent = createEventType(EventEnumType.SERVER_STOP);
        putEvent(serverStopEvent);

        LOG.info("Send SERVER_STOP event to SAM Server successful!");
    }
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();
		}
	}
1264732
public void shutdownApplication( String applicationName ) throws ManagementWsException {
		this.logger.finer( "Removing application " + applicationName + "..." );

		WebResource path = this.resource
					.path( UrlConstants.APPLICATIONS )
					.path( applicationName )
					.path( "shutdown" );

		ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class );
		String text = response.getEntity( String.class );
		this.logger.finer( text );
		if( Family.SUCCESSFUL != response.getStatusInfo().getFamily())
			throw new ManagementWsException( response.getStatusInfo().getStatusCode(), text );
	}
1098023
@Override
    public void shutdown(boolean compact) {
        try {
            if (view != null) {
                view.getRequestPanel().saveConfig(model.getOptionsParam().getConfig());
                view.getResponsePanel().saveConfig(model.getOptionsParam().getConfig());
            }

            getProxy(null).stopServer();
            super.shutdown(compact);
        } finally {
            // Ensure all extensions' config changes done during shutdown are saved.
            saveConfigurations();
        }
    }
1363849
public void contextDestroyed(ServletContextEvent event) {
        // Output a simple message to the server's console
        System.out.println("The Simple Web App. Has Been Removed");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                "/client.xml");
        LocatorService client = (LocatorService) context
                .getBean("locatorService");

        String serviceHost = this.context.getInitParameter("serviceHost");

        try {
            client.unregisterEndpoint(new QName("http://talend.org/esb/examples/", "GreeterService"), serviceHost);
        } catch (InterruptedExceptionFault e) {
            e.printStackTrace();
        } catch (ServiceLocatorFault e) {
            e.printStackTrace();
        }
        this.context = null;
    }
476717
protected void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "CommsClientServiceFacade deactivated, reason=");

        performAction(destroyChainAction);
        _sslOptions.deactivate(context);
        _sslFactoryProvider.deactivate(context);
        _isActivated = false;
    }
1240154
public static void shutdown(final LoggerContext context) {
        if (context != null && context instanceof Terminable) {
            ((Terminable) context).terminate();
        }
    }
404028
@On(Orchid.Lifecycle.Shutdown.class)
    public void onEndSession(Orchid.Lifecycle.Shutdown event) {
        executor.shutdown();
    }
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");
    }
380718
@Deactivate
    protected void deactivate(ComponentContext cc) {

        this.cContext = null;
        jaxwsInFlowClientSideGlobalHandlers.deactivate(cContext);
        jaxwsOutFlowClientSideGlobalHandlers.deactivate(cContext);
        jaxwsInFlowServerSideGlobalHandlers.deactivate(cContext);
        jaxwsOutFlowServerSideGlobalHandlers.deactivate(cContext);

        jaxrsInFlowClientSideGlobalHandlers.deactivate(cContext);
        jaxrsOutFlowClientSideGlobalHandlers.deactivate(cContext);
        jaxrsInFlowServerSideGlobalHandlers.deactivate(cContext);
        jaxrsOutFlowServerSideGlobalHandlers.deactivate(cContext);

    }
389456
public void destroy( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
        
        sh.removeAttribute( rc, attrName );
    }
854786
@SuppressWarnings("unchecked")
	public void sessionDestroyed(HttpSessionEvent se) {
		WebContext<HttpSession> context = (WebContext<HttpSession>) container.component(container.contexts().get(Session.class));
		context.deassociate(se.getSession());
	}