in src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java [61:94]
public void execute(final InstallationContext ctx) {
@SuppressWarnings("unchecked")
final Set<Long> ids = (Set<Long>) this.getResource().getAttribute(ATTR);
int started = 0;
if ( ids != null ) {
final Set<Long> remove = new HashSet<Long>();
for(final Long id : ids) {
final Bundle bundle = this.getBundleContext().getBundle(id);
if ( bundle != null
&& bundle.getState() != Bundle.ACTIVE
&& bundle.getState() != Bundle.STARTING
&& bundle.getState() != Bundle.STOPPING
&& bundle.getState() != Bundle.UNINSTALLED) {
try {
bundle.start();
started++;
ctx.log("Started bundle {}", bundle);
remove.add(id);
} catch (final BundleException e) {
getLogger().info("Unable to start bundle {} : {}", bundle, e.getMessage());
} catch (final IllegalStateException ie) {
getLogger().info("Unable to start bundle {} : {}", bundle, ie.getMessage());
remove.add(id);
}
} else {
// bundle might be null(!)
getLogger().debug("Bundle does not need restart: {} (state {})", bundle, (bundle == null ? "uninstalled" : bundle.getState()));
remove.add(id);
}
}
ids.removeAll(remove);
}
getLogger().debug("{} bundles were started", started);
}