in src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java [197:236]
private void setupRunModes(final BundleContext context) {
final Set<String> modesSet;
// check configuration property first
final String prop = context.getProperty(RUN_MODES_PROPERTY);
if (prop != null && prop.trim().length() > 0) {
modesSet = parseRunModes(prop);
} else {
modesSet = new HashSet<>();
}
// handle configured options
this.handleOptions(modesSet, context.getProperty(RUN_MODE_OPTIONS));
// handle configured install options
// read persisted options if restart or update
final List<Options> storedOptions = readOptions(context);
if (storedOptions != null) {
for (final Options o : storedOptions) {
for (final String m : o.modes) {
modesSet.remove(m);
}
modesSet.add(o.selected);
}
}
// now install options
final List<Options> optionsList = this.handleOptions(modesSet, context.getProperty(RUN_MODE_INSTALL_OPTIONS));
// and always save new install options
writeOptions(context, optionsList);
// make the set unmodifiable and synced
// we probably don't need a synced set as it is read only
this.runModes = Collections.synchronizedSet(Collections.unmodifiableSet(modesSet));
if (this.runModes.size() > 0) {
logger.info("Active run modes: {}", this.runModes);
} else {
logger.info("No run modes active");
}
}