Objects are disposed of via the Registry since the Registry manages the creation/initialisation of the objects
it must also take care of disposing them. However, a user may want to initiate a dispose via the
DefaultMuleContext
so the dispose Lifecycle phase for the
DefaultMuleContext
needs to call dispose on the Registry.
The MuleContextDisposePhase defines the lifecycle behaviour when the Mule context is disposed. The MuleContext is associated
with one or more registries that inherit the lifecycle of the MuleContext.
This phase is responsible for disposing objects. Any object that implements
Disposable
will
have its
Disposable.dispose()
method called. Objects are initialised in the order based on type:
Service
,
Model
,
Agent
,
Connector
, followed
by any other object that implements
Disposable
.