To be executed after container objects are stopped (AfterClassContainerObjectObserver)
439285
public void stopNetworkObjects(@Observes(precedence = 90) AfterClass afterClass) {

        final NetworkRegistry networkRegistry = networkRegistryInstance.get();
        final List<String> networksToRemove = networkRegistry.getNetworkIds()
                .stream()
                .filter(id -> networkRegistry.getNetwork(id).hasMetadata(IsNetworkContainerObject.class))
                .collect(Collectors.toList());

        // To avoid Concurrent modification exception
        networksToRemove.stream().forEach(id -> {
            logger.fine(String.format("Stopping Network %s", id));
            dockerClientExecutorInstance.get().removeNetwork(id);
            networkRegistry.removeNetwork(id);
        });

    }
1270873
public static void disposeSplash() {
        if (instance != null) {
            Container container = instance;
            while ((container = container.getParent()) != null)
            {
                if (container instanceof Window)
                    ((Window)container).dispose();
            }
            instance = null;
        }
    }
421388
@Override
    public void afterCompletion(int status) {

        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "afterCompletion");
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(
                     tc,
                     "Using transaction wrapper@" + Integer.toHexString(this.hashCode()));
        }

        if (mcWrapper.isMCAborted()) {
            Tr.exit(tc, "Connection was aborted. Exiting afterCompletion.");
            return;
        }

        // When afterCompletionCode is called we need to reset the registeredForSync flag.
        registeredForSync = false;
        this.hasRollbackOccured = false;
        /*
         * Mark the transaction complete in the wrapper
         */
        // Do NOT catch runtime exections here.  Let them flow out of the component.
        mcWrapper.transactionComplete();

        if (tc.isDebugEnabled()) {
            if (mcWrapper.getHandleCount() != 0) {
                // Issue warning that Connections have not been closed by the end of the current UOW
                //  scope and will be closed by the CM.
                //            Tr.warning(this, tc,"HANDLE_NOT_CLOSED_J2CA0055");
                Tr.debug(this, tc, "Information:  handle not closed at end of UOW. Connection from pool " + mcWrapper.gConfigProps.getXpathId());
            }
        }

        // Do NOT catch the runtime exception which getConnectionManager might throw.
        // If this is thrown it is an internal bug and needs to be fixed.
        // Allow the rte to flow up to the container.
        boolean shareable = mcWrapper.getConnectionManager().shareable();

        //  - Simplified the following if/else construct taking advantage of the
        //             new releaseToPoolManger call on mcWrapper.
        //
        // If the connection is shareable, or it is non-shareable and the handleCount is
        // zero, then release it back to the poolManger, otherwise simply reset the
        // transaction related variables.
        //
        // Note: shareable connections are released at the end of transactions regardless of
        //  outstanding handles because we don't supports handled being associated to an active
        //  managedConnection outside of a sharing boundary.
        //
        //  if the MCWrapper is stale we will release the connection to the pool.
        //
        if ((shareable) || (!shareable && mcWrapper.getHandleCount() == 0) || mcWrapper.isStale()) {

            if (tc.isDebugEnabled()) {
                Tr.debug(this, tc,
                         "Releasing the connection to the pool. shareable = " + shareable + "  handleCount = " + mcWrapper.getHandleCount() + "  isStale = " + mcWrapper.isStale());
            }

            try {
                mcWrapper.releaseToPoolManager();
            } catch (Exception e) {
                // No need to rethrow this exception since nothing can be done about it,
                //  and the application has successfully finished its use of the connection.
                com.ibm.ws.ffdc.FFDCFilter.processException(
                                                            e,
                                                            "com.ibm.ejs.j2c.LocalTransactionWrapper.afterCompletion",
                                                            "711",
                                                            this);
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "afterCompletionCode for datasource " + mcWrapper.gConfigProps.cfName + ":  caught Exception", e);
                }
            }

        } // end ((shareable) || (!shareable && mcWrapper.getHandleCount() == 0))
        else {
            /*
             * The cleanup of the coordinator enlisted flag should only be done for non sharable connections, in
             * other cases, the coord is set to null in mcWrapper.releaseToPoolManager(). We only need to worry about this
             * if the handleCount is greater than 0 (in which case the cleanup will be done by the poolManager). Same
             * thing for the tranFailed flag in the MCWrapper.
             */
            mcWrapper.setUOWCoordinator(null);
            // Reset the serialReuseCount since it is only valid for the duration of
            // the LTC. Note that the release path above will also reset it via mcWrapper.cleanup().
            enlisted = false;
        }

        if (tc.isEntryEnabled()) {
            Tr.exit(this, tc, "afterCompletion");
        }
    }
695829
protected final void doStop() {

        log.info("Stopping {} in {}", new Object[]{this, getLocationOrNull()});

        if (getAttribute(SERVICE_STATE_ACTUAL)
                .equals(Lifecycle.STOPPED)) {
            log.warn("The entity {} is already stopped", new Object[]{this});
            return;
        }

        ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING);
        try {
            preStop();
            driver.stop();
            postDriverStop();
            postStop();
            ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED);
            log.info("The entity stop operation {} is completed without errors",
                    new Object[]{this});
        } catch (Throwable t) {
            ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE);
            throw Exceptions.propagate(t);
        }
    }
198376
@Override
  public void onContainerStopped(final ContainerId containerId) {
    final boolean hasContainer = this.containers.hasContainer(containerId.toString());
    if (hasContainer) {
      this.reefEventHandlers.onResourceStatus(
          ResourceStatusEventImpl.newBuilder()
             .setIdentifier(containerId.toString())
             .setState(State.DONE)
             .build());
    }
  }
377329
public void afterCompletion(int status)
    {
        if(afterCompletionCall) return;

        log.info("Method afterCompletion was called");
        try
        {
            switch(status)
            {
                case Status.STATUS_COMMITTED:
                    if(log.isDebugEnabled())
                    {
                        log.debug("Method afterCompletion: Do commit internal odmg-tx, status of JTA-tx is " + TxUtil.getStatusString(status));
                    }
                    commit();
                    break;
                default:
                    log.error("Method afterCompletion: Do abort call on internal odmg-tx, status of JTA-tx is " + TxUtil.getStatusString(status));
                    abort();
            }
        }
        finally
        {
            afterCompletionCall = true;
            log.info("Method afterCompletion finished");
        }
    }
176405
@Override
    public boolean handleObject(ObjectInfo info) {
        logWriter.println(info.getPid());
        try {
            pauseOrCancelIfRequested();
            return true;
        } catch (TaskCanceledException e) {
            canceledException = e;
            return false;
        }
    }
247365
public static void finalizeHandler(ServerBootstrap b, ChannelOperations.OnSetup
			opsFactory, ConnectionObserver childListener) {
		Objects.requireNonNull(b, "bootstrap");
		Objects.requireNonNull(opsFactory, "ops");
		Objects.requireNonNull(childListener, "childListener");

		BootstrapPipelineHandler pipeline = null;
		ChannelHandler handler = b.config().childHandler();
		if (handler instanceof BootstrapPipelineHandler) {
			pipeline = (BootstrapPipelineHandler) handler;
		}

		b.childHandler(new BootstrapInitializerHandler(pipeline, opsFactory, childListener));
	}
1363541
synchronized void onComplete(@javax.annotation.Nullable Throwable error) {
    if (isCompleted()) {
      return;
    }
    currentConfigObserver = null;
    // TODO(songya): add Runnable
    Status status;
    if (error == null) {
      status = Status.OK;
    } else if (error instanceof StatusRuntimeException) {
      status = ((StatusRuntimeException) error).getStatus();
    } else {
      status = Status.UNKNOWN;
    }
    terminateStatus = status;
  }
805399
private void afterDataFsync(Result<Boolean> result,
                              int position,
                              FsyncType fsyncType,
                              ArrayList<SegmentFsyncCallback> listeners)
  {
    try {
      completeIndex(position);
      
      Result<Boolean> cont = result.then((v,r)->
        afterIndexFsync(r, fsyncType, listeners));

      if (fsyncType.isSchedule()) {
        _sOut.fsyncSchedule(cont);
      }
      else {
        _sOut.fsync(cont);
        
      }
    } catch (Throwable e) {
      result.fail(e);
    }
  }
336788
public void objectTerminated(Object object, Exception e)
	{
		if (e != null)
		{
			VdmDebugPlugin.log(e);
			final Job job = new Job("ServerRestart")
			{

				protected IStatus run(IProgressMonitor monitor)
				{
					restartServer(serverPort);
					return Status.OK_STATUS;
				}

			};
			job.schedule(2000);
		}
	}
451917
public void exiting(Object object) {
        if (!getLogger().isLoggable(Level.FINER)) {
            return;
        }
        FrameInfo fi = getLoggingFrame();
        getLogger().exiting(fi.className, fi.methodName, object);
    }
1040711
protected void repairAfterLazy() {
    for (int k = 0; k < highLowContainer.size(); ++k) {
      MappeableContainer c = highLowContainer.getContainerAtIndex(k);
      ((MutableRoaringArray) highLowContainer).setContainerAtIndex(k, c.repairAfterLazy());
    }
  }
1322335
public void waitForExit() throws InterruptedException {
        try {
            dockerClient.waitContainer(container.id());
        } catch (DockerException e) {
            throw new IllegalStateException(e);
        }
    }
1271465
@Override
    public void afterCompletion(int status)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "afterCompletion : " + status + " : " + this);

        closeTxEntityManager(ivEm, true);

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "afterCompletion");
    }
408593
private CompletableFuture<Void> stopContainer(int containerId) {
        log.info("Stopping Container {}.", containerId);
        ContainerHandle handle = handles.get(containerId);
        if (handle == null) {
            log.warn("Container {} handle is null, container is pending start or already unregistered.", containerId);
            return null;
        } else {
            this.pendingTasks.add(containerId);
            try {
                return registry
                        .stopContainer(handle, CLOSE_TIMEOUT_PER_CONTAINER)
                        .whenComplete((aVoid, throwable) -> {
                            if (throwable != null) {
                                log.warn("Stopping container {} failed: {}", containerId, throwable);
                            }
                            try {
                                // We remove the handle and don't attempt retry on stop container failures.
                                unregisterHandle(containerId);
                            } finally {
                                // The pending task has to be removed after the handle is removed to avoid inconsistencies
                                // with the container state.
                                // Using finally block to ensure this is always called, otherwise this will prevent other
                                // tasks from being attempted for this container id.
                                this.pendingTasks.remove(containerId);
                            }
                        });
            } catch (Throwable e) {
                // The pending task has to be removed on all failures to enable retries.
                this.pendingTasks.remove(containerId);
                throw e;
            }
        }
    }
975840
private synchronized void writeObject(ObjectOutputStream oos)
        throws IOException
    {
        if (_control != null)
        {
            //
            // If the implementation class is marked as transient/stateless, then reset the
            // reference to it prior to serialization.  A new instance will be created by
            // ensureControl() upon first use after deserialization.
            // If the implementation class is not transient, then invoke the ImplInitializer
            // resetServices method to reset all contextual service references to null, as
            // contextual services should never be serializated and always reassociated on 
            // deserialization.
            //
            ControlImplementation implAnnot = (ControlImplementation)_implClass.getAnnotation(ControlImplementation.class);
            assert implAnnot != null;
            if (implAnnot.isTransient())
            {
                _control = null;
            }
            else
            {
                getImplInitializer().resetServices(this, _control);
                _hasServices = false;
            }
        }

        oos.defaultWriteObject();
    }