Interface DeactivatedContainer
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
ContainerTermination
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 Summary
Modifier and TypeMethodDescriptionReturns the context object that was previously attached to the correspondingContainerBuilder
through theContainerBuilder.setAppContext(Object)
method.void
close()
Close this DeactivatedContainer.void
notifyTermination
(Runnable task) Schedules the givenRunnable
to execute once this DeactivatedContainer has terminated.
-
Method Details
-
appContext
Object appContext()Returns the context object that was previously attached to the corresponding
ContainerBuilder
through theContainerBuilder.setAppContext(Object)
method. This is useful for trackingApplication
specific resources that are to be tracked alongside aContainer
.- Returns:
- The Application context.
-
notifyTermination
Schedules the given
Runnable
to execute once this DeactivatedContainer has terminated. A DeactivatedContainer is considered to have terminated once there are no moreRequest
s,Response
s or correspondingContentChannel
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.
- 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 interfaceAutoCloseable
-