Skip to content

Commit 6068c59

Browse files
author
Vladimir Kotal
authored
record the time needed to refresh search managers (#3786)
* record the time needed to refresh search managers * add log at the end of applyConfig() * avoid string concatenation reported by Sonar
1 parent a160de5 commit 6068c59

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/RuntimeEnvironment.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import org.opengrok.indexer.util.LazilyInstantiate;
7575
import org.opengrok.indexer.util.PathUtils;
7676
import org.opengrok.indexer.util.ResourceLock;
77+
import org.opengrok.indexer.util.Statistics;
7778
import org.opengrok.indexer.web.Prefix;
7879
import org.opengrok.indexer.web.Util;
7980
import org.opengrok.indexer.web.messages.Message;
@@ -1733,6 +1734,8 @@ public void applyConfig(Configuration config, boolean reindex, CommandTimeoutTyp
17331734
for (ConfigurationChangedListener l : listeners) {
17341735
l.onConfigurationChanged();
17351736
}
1737+
1738+
LOGGER.log(Level.INFO, "Done applying configuration");
17361739
}
17371740

17381741
public void setIndexTimestamp() throws IOException {
@@ -1762,9 +1765,12 @@ public void maybeRefreshIndexSearchers(Iterable<String> projects) {
17621765
}
17631766

17641767
public void maybeRefreshIndexSearchers() {
1768+
LOGGER.log(Level.INFO, "refreshing searcher managers");
1769+
Statistics stat = new Statistics();
17651770
for (Map.Entry<String, SearcherManager> entry : searcherManagerMap.entrySet()) {
17661771
maybeRefreshSearcherManager(entry.getValue());
17671772
}
1773+
stat.report(LOGGER, "Done refreshing searcher managers");
17681774
}
17691775

17701776
/**
@@ -1809,12 +1815,11 @@ public void refreshSearcherManagerMap() {
18091815
// so that it cannot produce new IndexSearcher objects.
18101816
if (!getProjectNames().contains(entry.getKey())) {
18111817
try {
1812-
LOGGER.log(Level.FINE,
1813-
"closing SearcherManager for project" + entry.getKey());
1818+
LOGGER.log(Level.FINE, "closing SearcherManager for project {0}", entry.getKey());
18141819
entry.getValue().close();
18151820
} catch (IOException ex) {
18161821
LOGGER.log(Level.SEVERE,
1817-
"cannot close SearcherManager for project" + entry.getKey(), ex);
1822+
String.format("cannot close SearcherManager for project %s", entry.getKey()), ex);
18181823
}
18191824
toRemove.add(entry.getKey());
18201825
}

0 commit comments

Comments
 (0)