Search in sources :

Example 1 with DeploymentStopException

use of org.mule.runtime.deployment.model.api.DeploymentStopException in project mule by mulesoft.

the class DefaultMuleApplication method stop.

@Override
public void stop() {
    if (this.artifactContext == null || !this.artifactContext.getMuleContext().getLifecycleManager().isDirectTransition(Stoppable.PHASE_NAME)) {
        return;
    }
    if (this.artifactContext == null) {
        withContextClassLoader(null, () -> {
            // app never started, maybe due to a previous error
            if (logger.isInfoEnabled()) {
                logger.info(format("Stopping app '%s' with no mule context", descriptor.getName()));
            }
        });
        status = ApplicationStatus.STOPPED;
        return;
    }
    artifactContext.getMuleContext().getLifecycleManager().checkPhase(Stoppable.PHASE_NAME);
    try {
        withContextClassLoader(null, () -> {
            if (logger.isInfoEnabled()) {
                logger.info(miniSplash(format("Stopping app '%s'", descriptor.getName())));
            }
        });
        this.artifactContext.getMuleContext().stop();
    } catch (MuleException e) {
        throw new DeploymentStopException(createStaticMessage(format("Error stopping application '%s'", descriptor.getName())), e);
    }
}
Also used : DeploymentStopException(org.mule.runtime.deployment.model.api.DeploymentStopException) MuleException(org.mule.runtime.api.exception.MuleException)

Aggregations

MuleException (org.mule.runtime.api.exception.MuleException)1 DeploymentStopException (org.mule.runtime.deployment.model.api.DeploymentStopException)1