use of org.opengrok.indexer.util.ResourceLock in project OpenGrok by OpenGrok.
the class RuntimeEnvironment method setConfiguration.
/**
* Sets the configuration and performs necessary actions.
*
* @param configuration new configuration
* @param subFileList list of repositories
* @param cmdType command timeout type
*/
public synchronized void setConfiguration(Configuration configuration, List<String> subFileList, CommandTimeoutType cmdType) {
try (ResourceLock resourceLock = configLock.writeLockAsResource()) {
// noinspection ConstantConditions to avoid warning of no reference to auto-closeable
assert resourceLock != null;
this.configuration = configuration;
}
// HistoryGuru constructor needs environment properties so no locking is done here.
HistoryGuru histGuru = HistoryGuru.getInstance();
// Set the working repositories in HistoryGuru.
if (subFileList != null) {
histGuru.invalidateRepositories(getRepositories(), subFileList, cmdType);
} else {
histGuru.invalidateRepositories(getRepositories(), cmdType);
}
// The invalidation of repositories above might have excluded some
// repositories in HistoryGuru so the configuration needs to reflect that.
setRepositories(new ArrayList<>(histGuru.getRepositories()));
// generate repository map is dependent on getRepositories()
try {
generateProjectRepositoriesMap();
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "Cannot generate project - repository map", ex);
}
// populate groups is dependent on repositories map
populateGroups(getGroups(), new TreeSet<>(getProjects().values()));
includeFiles.reloadIncludeFiles();
}
Aggregations