From d00874c660c7c4a3ac1964220b83cd475a653c3f Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 29 Oct 2014 21:46:28 +0100 Subject: SONAR-5375 Minor optimization to remove all issues once for a given component --- .../plugins/core/issue/IssueTrackingDecorator.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'plugins/sonar-core-plugin') diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java index f46e87baf76..27ee9a8ca6f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java @@ -25,7 +25,12 @@ import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.batch.*; +import org.sonar.api.batch.Decorator; +import org.sonar.api.batch.DecoratorBarriers; +import org.sonar.api.batch.DecoratorContext; +import org.sonar.api.batch.DependedUpon; +import org.sonar.api.batch.DependsUpon; +import org.sonar.api.batch.SonarIndex; import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.issue.Issuable; import org.sonar.api.issue.Issue; @@ -69,13 +74,13 @@ public class IssueTrackingDecorator implements Decorator { private final RuleFinder ruleFinder; public IssueTrackingDecorator(IssueCache issueCache, InitialOpenIssuesStack initialOpenIssues, IssueTracking tracking, - LastSnapshots lastSnapshots, SonarIndex index, - IssueHandlers handlers, IssueWorkflow workflow, - IssueUpdater updater, - Project project, - ResourcePerspectives perspectives, - RulesProfile rulesProfile, - RuleFinder ruleFinder) { + LastSnapshots lastSnapshots, SonarIndex index, + IssueHandlers handlers, IssueWorkflow workflow, + IssueUpdater updater, + Project project, + ResourcePerspectives perspectives, + RulesProfile rulesProfile, + RuleFinder ruleFinder) { this.issueCache = issueCache; this.initialOpenIssues = initialOpenIssues; this.tracking = tracking; @@ -107,9 +112,9 @@ public class IssueTrackingDecorator implements Decorator { void doDecorate(Resource resource) { Collection issues = Lists.newArrayList(); for (Issue issue : issueCache.byComponent(resource.getEffectiveKey())) { - issueCache.remove(issue); issues.add((DefaultIssue) issue); } + issueCache.removeAll(resource.getEffectiveKey()); // issues = all the issues created by rule engines during this module scan and not excluded by filters // all the issues that are not closed in db before starting this module scan, including manual issues -- cgit v1.2.3