Declarative Services method to deactivate this component.
Best practice: this should be a protected method, not public or private

@param context context for this component instance.
185312
protected void deactivate(ComponentContext context) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "deactivate");

        destroyConnectionFactories(true);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "deactivate", id + ' ' + context.getProperties().get(JNDI_NAME));
    }
139271
@SuppressWarnings("unchecked")
	public void deassociate(HttpServletRequest context) {
		Map<Descriptor<?>, Object> components 
				= (Map<Descriptor<?>, Object>) context.getAttribute(COMPONENTS);
		
		for (Object component : components.values()) {
			try {
				Event.of(Passivated.class).on(component).fire();
			} catch (Exception e) {}
		}
		
		context.removeAttribute(COMPONENTS);
		
		for (Object component : components.values()) {
			try {
				Event.of(Destroyed.class).on(component).fire();
			} catch (Exception e) {}
		}
	}
1122200
@Override
    public void contextDestroyed(ServletContextEvent event) {
        try {
            _gate.await();
            _logger.info("Stopping Argus web services.");
            _system.getServiceFactory().getMonitorService().stopRecordingCounters();
            _system.getServiceFactory().getSchedulingService().stopAlertScheduling();
            _system.getServiceFactory().getWardenService().disableWarden();
            _system.stop();
        } catch (InterruptedException ex) {
            _logger.info("Interrupted while waiting for startup to complete.");
        }
    }
486042
@Override
  public void onContextClose(final String contextId) {
    this.serviceStub.activeContextOp(
        ActiveContextRequest.newBuilder()
            .setContextId(contextId)
            .setCloseContext(true)
            .build());
  }
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();
        }
    }
749294
@Override
	public final void cleanup(Context context) throws IOException, InterruptedException {
		cleanup(this.context, collector);
		collector.close();
		super.cleanup(context);
	}
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);
        }
    }
723774
private void releaseContext(String contextId) {
        if (mode == ContextLockingMode.DEACTIVATED) {
            return;
        }
        synchronized (activeWritingContexts) {
            activeWritingContexts.remove(contextId);
        }
    }
1022137
protected void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(this, tc, "deactivate", context);
        configAdminRef.deactivate(context);
        variableRegistryRef.deactivate(context);
        metaTypeServiceRef.deactivate(context);
        wsConfigurationHelperRef.deactivate(context);
    }
1185238
@Deactivate
    protected void deactivate(ComponentContext cc) {
        executorServiceRef.deactivate(cc);
        scheduledExecutorServiceRef.deactivate(cc);
        classLoadingServiceSR.deactivate(cc);

        if (workQueueBusListener != null) {
            LibertyApplicationBusFactory.getInstance().unregisterApplicationBusListener(workQueueBusListener);
        }
    }
77138
protected void deactivate(ComponentContext context) {
        transactionInflowManagerRef.deactivate(context);

        // TODO remove the following temporary code once the transaction manager provides a proper mechanism to prevent a transaction on multiple threads at once
        SuspendCount suspendCount = suspendCountRef.get();
        if (suspendCount != null)
            ((UOWCurrent) transactionManager).unsetUOWEventListener(suspendCount);
    }
373757
public void stop(BundleContext context) throws Exception {
        ClassServiceUtility.log(context, LogService.LOG_INFO, "Stopping " + this.getClass().getName() + " Bundle");
    	if (this.shutdownService(service, context))
    		service = null;
        // Unregisters automatically
        this.context = null;
    }
1016693
@SuppressWarnings("unused")
    @Deactivate
    protected void deactivate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Deactivating the HTTP pipeline event handler");
        }
    }
317967
protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "activate", context);
        authDataServiceRef.activate(context);
        deferrableSchedXSvcRef.activate(context);
        execSvcRef.activate(context);
        nonDeferrableSchedXSvcRef.activate(context);
        rrsXAResFactorySvcRef.activate(context);
        variableRegistrySvcRef.activate(context);
    }
544290
public void deactivate(ComponentContext context) {
        if (contextRef.get() == null) {
            // Components are only deactivated if they activate successfully,
            // and component instances are discarded after being deactivated.
            // This is either DS or programmer error.
            throw new IllegalStateException("not activated");
        }

        this.contextRef.set(null);
    }
1337335
public void deactivate(ComponentContext cc) throws IOException {
        ConfigProviderResolver.setInstance(null);
        shutdown();
        scheduledExecutorServiceRef.deactivate(cc);
    }
260392
@Trivial
    protected void activate(ComponentContext componentContext) {
        Dictionary<String, ?> properties = componentContext.getProperties();
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "activate", properties);

        contextSvcRef.activate(componentContext);

        String jndiName = (String) properties.get(JNDI_NAME);
        name = jndiName == null ? (String) properties.get(CONFIG_ID) : jndiName;

        defaultExecutionProperties = new TreeMap<String, String>();
        defaultExecutionProperties.put(WSContextService.DEFAULT_CONTEXT, WSContextService.UNCONFIGURED_CONTEXT_TYPES);
        defaultExecutionProperties.put(WSContextService.TASK_OWNER, name);

        createDaemonThreads = (Boolean) properties.get(CREATE_DAEMON_THREADS);
        defaultPriority = (Integer) properties.get(DEFAULT_PRIORITY);
        Integer maxPriority = (Integer) properties.get(MAX_PRIORITY);
        threadGroup = AccessController.doPrivileged(new CreateThreadGroupAction(name + " Thread Group", maxPriority), threadGroupTracker.serverAccessControlContext);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "activate");
    }