super();
}
public TransitionResultSet processTransitions(ModuleStateHolder moduleStateHolder, Application application, TransitionSet transitions) {
TransitionResultSet resultSet = new TransitionResultSet();
try {
Assert.notNull(transitionProcessorRegistry, TransitionProcessorRegistry.class.getSimpleName() + " cannot be null");
Collection<? extends ModuleStateChange> changes = transitions.getModuleTransitions();
for (ModuleStateChange change : changes) {
if (logger.isDebugEnabled()) {
logger.debug("Processing module state change: " + change);
}
String transition = change.getTransition();
ModuleDefinition currentModuleDefinition = change.getModuleDefinition();
TransitionProcessor transitionProcessor = transitionProcessorRegistry.getTransitionProcessor(transition);
TransitionResult result;
try {
transitionProcessor.process(application, transitions.getNewRootModuleDefinition(), currentModuleDefinition);
result = new TransitionResult(change);
}
catch (Throwable error) {
result = new TransitionResult(change, error);
}
resultSet.addResult(result);
if (result.getError() == null && moduleStateChangeNotifier != null) {
moduleStateChangeNotifier.notify(moduleStateHolder, result);
}
}
resultSet.complete();
transitionsLogger.logTransitions(resultSet);
} finally {
RootModuleDefinition rootModuleDefinition = transitions.getNewRootModuleDefinition();
moduleStateHolder.setRootModuleDefinition(rootModuleDefinition);