diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-19 17:04:01 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-20 14:27:54 +0100 |
commit | 1918e8d54688f2eb7e33631bd3ba516042d1db54 (patch) | |
tree | e9d7279f9661454c541970f91a9a064d7908ab49 /sonar-batch/src/main/java | |
parent | 40de2916d07f4a7be0632255c25e8deacefed473 (diff) | |
download | sonarqube-1918e8d54688f2eb7e33631bd3ba516042d1db54.tar.gz sonarqube-1918e8d54688f2eb7e33631bd3ba516042d1db54.zip |
SONAR-6844 Add a progress report on issue tracking phase
Diffstat (limited to 'sonar-batch/src/main/java')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTransition.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTransition.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTransition.java index aca6103c480..4cdb21783a3 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTransition.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTransition.java @@ -19,8 +19,8 @@ */ package org.sonar.batch.issue.tracking; +import org.sonar.batch.util.ProgressReport; import org.sonar.batch.issue.IssueTransformer; - import org.sonar.api.batch.BatchSide; import org.sonar.api.resources.Project; import org.sonar.batch.index.BatchComponent; @@ -37,6 +37,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.concurrent.TimeUnit; @BatchSide public class IssueTransition { @@ -66,9 +67,24 @@ public class IssueTransition { } BatchReportReader reader = new BatchReportReader(reportPublisher.getReportDir()); + int nbComponents = componentCache.all().size(); + + if (nbComponents == 0) { + return; + } - for (BatchComponent component : componentCache.all()) { - trackIssues(reader, component); + ProgressReport progressReport = new ProgressReport("issue-tracking-report", TimeUnit.SECONDS.toMillis(10)); + progressReport.start("Performing issue tracking"); + int count = 0; + + try { + for (BatchComponent component : componentCache.all()) { + trackIssues(reader, component); + count++; + progressReport.message(count + "/" + nbComponents + " components tracked"); + } + } finally { + progressReport.stop(count + "/" + nbComponents + " components tracked"); } } |