This method is invoked just before container termination to clean
up server-side Future objects.
498696
public synchronized void finalReap() {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());

        // Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing
        // all the entries no matter if they have timed out or not.  Cancel alarm if set.    d623593
        if (ivFuture != null) {
            ivIsCanceled = true;
            ivFuture.cancel(false);
            ivFuture = null;
        }

        for (Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator(); iterator.hasNext();) {
            RemoteAsyncResultImpl asyncResult = iterator.next();
            releaseResources(asyncResult); // d690014.3
            iterator.remove();
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
    }
209680
@Override
    public final void after() {
        log.debug("after {}", containerShortId);
        try {
            dockerLogs.close();
            ContainerState state = dockerClient.inspectContainer(container.id()).state();
            log.debug("{} state {}", containerShortId, state);
            if (state.running()) {
                if (builder.stopOptions().contains(StopOption.KILL)) {
                    dockerClient.killContainer(container.id());
                    log.info("{} killed", containerShortId);
                } else {
                    dockerClient.stopContainer(container.id(), STOP_TIMEOUT);
                    log.info("{} stopped", containerShortId);
                }
            }
            if (builder.stopOptions().contains(StopOption.REMOVE)) {
                dockerClient.removeContainer(container.id(), DockerClient.RemoveContainerParam.removeVolumes());
                log.info("{} deleted", containerShortId);
                container = null;
            }
        } catch (DockerException | InterruptedException e) {
            throw new IllegalStateException(e);
        }
    }
276068
def cleanup(self):
        ''''''
        if self.state == ClientState.WAITING_FOR_RESULT:
            # There is an ongoing call to execute()
            # Not sure what to do here
            logger.warn('cleanup() called while state is WAITING_FOR_RESULT: ignoring')
        elif self.state == ClientState.TERMINATING:
            # terminate() has been called but we have not recieved SIGCHLD yet
            # Not sure what to do here
            logger.warn('cleanup() called while state is TERMINATING: ignoring')
        elif self.state in ClientState.TerminatedSet:
            # We have already terminated
            # TODO: should we deal with TERMINATED_ASYNC in some special way?
            logger.debug('cleanup() called while state is TERMINATING: nothing needs to be done')
        else:
            logger.debug('cleanup() called while state is %s: attempting to terminate',
                          self.strstate)
            try:
                self.terminate()
            except ProcessTerminationError as ex:
                # Terminate can throw a ProcessTerminationError if the
                # process terminated at some point between the last
                # execute() and the call to terminate()
                # For now we just ignore this.
                pass
111376
public void dispose(){
        classAnalysisMap.clear();
        classAnalysisEngineMap.clear();
        analysisLocals.clear();
        databaseFactoryMap.clear();
        databaseMap.clear();
        methodAnalysisEngineMap.clear();
    }
420815
protected void cleanUp() {
        int prevNodeCount = ghStorage.getNodes();
        PrepareRoutingSubnetworks preparation = new PrepareRoutingSubnetworks(ghStorage, encodingManager.fetchEdgeEncoders());
        preparation.setMinNetworkSize(minNetworkSize);
        preparation.setMinOneWayNetworkSize(minOneWayNetworkSize);
        preparation.doWork();
        int currNodeCount = ghStorage.getNodes();
        logger.info("edges: " + Helper.nf(ghStorage.getAllEdges().length()) + ", nodes " + Helper.nf(currNodeCount)
                + ", there were " + Helper.nf(preparation.getMaxSubnetworks())
                + " subnetworks. removed them => " + Helper.nf(prevNodeCount - currNodeCount)
                + " less nodes");
    }
1048019
private void onCleanup(Object connection)
    {
        // if not running within transaction boundary
        if (this.connection != null)
        {
            if (settings != null)
            {
                ((Jedis) connection).configResetStat();
            }
            factory.releaseConnection((Jedis) this.connection);
        }

        this.connection = null;
    }
833478
synchronized void processFinished() {
        final InternalState required = this.requiredState;
        final InternalState state = this.internalState;
        // If the server was not stopped
        if(required == InternalState.STOPPED && state == InternalState.PROCESS_STOPPING) {
            finishTransition(InternalState.PROCESS_STOPPING, InternalState.PROCESS_STOPPED);
        } else {
            this.requiredState = InternalState.STOPPED;
            if ( !(internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), internalState, InternalState.PROCESS_STOPPING)
                    && internalSetState(getTransitionTask(InternalState.PROCESS_REMOVING), internalState, InternalState.PROCESS_REMOVING)
                    && internalSetState(getTransitionTask(InternalState.STOPPED), internalState, InternalState.STOPPED)) ){
                this.requiredState = InternalState.FAILED;
                internalSetState(null, internalState, InternalState.PROCESS_STOPPED);
            }
        }
    }
117143
private void terminate()
    {
        if (this.container != null) {
            final Cache<String, Integer> cache = this.container
                            .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
            Integer count = cache.get(InfinispanCache.COUNTERCACHE);
            if (count == null || count < 2) {
                this.container.stop();
            } else {
                count = count - 1;
                cache.put(InfinispanCache.COUNTERCACHE, count);
            }
        }
    }
1235453
def handle_wf_finalization(self):
        
        if ((not self.current.flow_enabled or (
            self.current.task_type.startswith('End') and not self.are_we_in_subprocess())) and
                    'token' in self.current.output):
            del self.current.output['token']
638209
public void cleanup() {
		long currentTime = System.currentTimeMillis();

		// remove entries which have exceeded their time to live
		cachedExecutionGraphs.values().removeIf(
			(ExecutionGraphEntry entry) -> currentTime >= entry.getTTL());
	}
1227849
private void cleanupEndpointActivationServiceInfo(EndpointActivationServiceInfo easInfo) {
        if (easInfo.serviceRef == null && easInfo.endpointFactories.isEmpty()) {
            endpointActivationServices.remove(easInfo.id);
        }
    }
279085
synchronized void removeServerProcess() {
        this.requiredState = InternalState.STOPPED;
        internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);
    }
277912
public <C extends ClassLoaderPreMortemCleanUp> void removeCleanUp(Class<C> clazz) {
    this.cleanUps.remove(clazz.getName());
  }
777006
@Override
  public void cleanup() {
    // @formatter:off
    this
      .setMLSupporter(null)
      .setStatisticsSupporter(null)
      .setIndexingHandler(null)
      .setJoinsHandler(null)
      .setMetaDataHandler(null)
      .setMiscellanyHandler(null)
      .setMissingDataHandler(null)
      .setMutabilityHandler(null)
      .setSqlHandler(null)
      .setPersistenceHandler(null)
      .setRepresentationHandler(null)
      .setReshapingHandler(null)
      .setSchemaHandler(null)
      .setStreamingDataHandler(null)
      .setTimeSeriesHandler(null)
      ;
    // @formatter:on
  }
1206194
private Mono<Void> cleanup(@Nullable Throwable cause) {
        if (future.isDone()) {
            return Mono.empty();
        }

        if (cause != null) {
            future.completeExceptionally(cause);
            logger.debug("{} Response future has been completed with a cause", ctx, cause);
            return Mono.empty();
        }

        final HttpResponse response = HttpResponse.of(armeriaHeaders);
        future.complete(response);
        logger.debug("{} Response future has been completed with an HttpResponse", ctx);
        return Mono.fromFuture(response.completionFuture());
    }
83899
public void clean() {
		
		this.sipApplicationSessionAttributeListeners.clear();
		this.sipApplicationSessionBindingListeners.clear();
		this.sipApplicationSessionActivationListeners.clear();
		this.sipApplicationSessionListeners.clear();
		this.sipSessionActivationListeners.clear();
		this.sipSessionAttributeListeners.clear();
		this.sipSessionBindingListeners.clear();
		this.sipSessionListeners.clear();
		this.sipServletsListeners.clear();
		this.sipErrorListeners.clear();
		this.servletContextListeners.clear();
		this.sipConnectorListeners.clear();
		this.proxyBranchListeners.clear();
		this.listenerServlets.clear();
		this.timerListener = null;
		this.containerListener = null;
	}
1183616
private void clean(Instances cleanAgainst, Instances toClean, boolean onlyLast) {
		if (cleanAgainst.numInstances() > this.kOption.getValue() && toClean.numInstances() > 0){
			if (onlyLast){
				cleanSingle(cleanAgainst, (cleanAgainst.numInstances()-1), toClean);
			}else{
				for (int i=0; i < cleanAgainst.numInstances(); i++){
					cleanSingle(cleanAgainst, i, toClean);
				}
			}
		}
	}