public interface ApplicationContainerContext
ApplicationContainerContext
instance can be used for holding per-container runtime state and objects and
managing their lifecycle. This context is shared across all tasks in the container.
Use ApplicationDescriptor.withApplicationContainerContextFactory(org.apache.samza.context.ApplicationContainerContextFactory<?>)
to provide the
ApplicationContainerContextFactory
. Use Context.getApplicationContainerContext()
to get the created
ApplicationContainerContext
instance for the current container.
A unique instance of ApplicationContainerContext
is created in each container. If the container moves or the
container model changes (e.g. due to failure or re-balancing), a new instance is created.
Use the ApplicationContainerContextFactory
to create any runtime state and objects, and the
start()
and stop()
methods to manage their
lifecycle.
Use ApplicationTaskContext
to hold unique runtime state and objects for each task within a container. Use
ContainerContext
to access framework-provided context for a container.
Unlike its ApplicationContainerContextFactory
, an implementation does not need to be Serializable
.
Modifier and Type | Method and Description |
---|---|
void |
start()
Starts this
ApplicationContainerContext before any tasks in the container are initialized and before
processing begins. |
void |
stop()
Stops this
ApplicationContainerContext after processing ends and after all tasks in the container
are closed. |
void start()
ApplicationContainerContext
before any tasks in the container are initialized and before
processing begins.
If this throws an exception, the container will fail to start.
void stop()
ApplicationContainerContext
after processing ends and after all tasks in the container
are closed.
If this throws an exception, the container will fail to fully shut down.