All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.jdisc.application.DeactivatedContainer Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.application;

import com.yahoo.jdisc.Container;
import com.yahoo.jdisc.Request;
import com.yahoo.jdisc.Response;
import com.yahoo.jdisc.handler.ContentChannel;

/**
 * 

This interface represents a {@link Container} which is in the process of being deactivated. Closing this * releases the last non-request-response reference to the container, and enables its termination. * An instance of this class is returned by the {@link ContainerActivator#activateContainer(ContainerBuilder)} method, * and is used to schedule a cleanup task that is executed once the the deactivated Container has terminated.

* * @author Simon Thoresen Hult */ public interface DeactivatedContainer extends AutoCloseable { /** *

Returns the context object that was previously attached to the corresponding {@link ContainerBuilder} through * the {@link ContainerBuilder#setAppContext(Object)} method. This is useful for tracking {@link Application} * specific resources that are to be tracked alongside a {@link Container}.

* * @return The Application context. */ Object appContext(); /** *

Schedules the given {@link Runnable} to execute once this DeactivatedContainer has terminated. A * DeactivatedContainer is considered to have terminated once there are no more {@link Request}s, {@link Response}s * or corresponding {@link ContentChannel}s being processed by components that belong to it.

* *

If termination has already occurred, this method immediately runs the given Runnable in the current thread.

* * @param task The task to run once this DeactivatedContainer has terminated. */ void notifyTermination(Runnable task); /** *

Close this DeactivatedContainer. This releases the last non-request-response reference to the container, and * enables its termination.

*/ @Override void close(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy