*/
package org.sonar.batch.scan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.ResourceModel;
import org.sonar.api.resources.Resource;
import org.sonar.api.resources.ResourceUtils;
import org.sonar.api.utils.HttpDownloader;
+import org.sonar.api.utils.TimeProfiler;
import org.sonar.batch.bootstrap.AnalysisMode;
import org.sonar.batch.bootstrap.ServerClient;
public class LastSnapshots implements BatchComponent {
+ private static final Logger LOG = LoggerFactory.getLogger(LastSnapshots.class);
+
private final AnalysisMode analysisMode;
private final DatabaseSession session;
private final ServerClient server;
}
private String loadSourceFromWs(Resource resource) {
+ TimeProfiler profiler = new TimeProfiler(LOG).start("Load previous source code of: " + resource.getEffectiveKey()).setLevelToDebug();
try {
return server.request("/api/sources?resource=" + resource.getEffectiveKey() + "&format=txt", false, analysisMode.getPreviewReadTimeoutSec() * 1000);
} catch (HttpDownloader.HttpException he) {
return "";
}
throw he;
+ } finally {
+ profiler.stop();
}
}