final ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
RuntimeModule runtimeModule = moduleStateHolder.removeModule(moduleDefinition);
if (runtimeModule != null) {
try {
ModuleRuntime moduleRuntime = getModuleRuntime(currentDefinition);
moduleRuntime.closeModule(application, runtimeModule);
}
catch (RuntimeException e) {
logger.error("Failed to handle unloading of application module " + moduleDefinition, e);
if (e instanceof RuntimeException) {