Interface DeactivatedContainer

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
ContainerTermination

public interface DeactivatedContainer extends AutoCloseable

This interface represents a 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 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
  • Method Details

    • appContext

      Object appContext()

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

      Returns:
      The Application context.
    • notifyTermination

      void notifyTermination(Runnable task)

      Schedules the given Runnable to execute once this DeactivatedContainer has terminated. A DeactivatedContainer is considered to have terminated once there are no more Requests, Responses or corresponding ContentChannels being processed by components that belong to it.

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

      Parameters:
      task - The task to run once this DeactivatedContainer has terminated.
    • close

      void close()

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

      Specified by:
      close in interface AutoCloseable