Skip to content

Commit

Permalink
Fix contention on addProblem in big projects
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Dec 17, 2024
1 parent a68b52f commit 9ddd0a2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package org.apache.maven.internal.impl.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand All @@ -42,7 +42,7 @@ class DefaultModelBuilderResult implements ModelBuilderResult {
private Model effectiveModel;
private List<Profile> activePomProfiles;
private List<Profile> activeExternalProfiles;
private final List<ModelProblem> problems = new CopyOnWriteArrayList<>();
private final Queue<ModelProblem> problems = new ConcurrentLinkedQueue<>();
private final DefaultModelBuilderResult problemHolder;

private final List<DefaultModelBuilderResult> children = new ArrayList<>();
Expand Down Expand Up @@ -125,7 +125,7 @@ public void setActiveExternalProfiles(List<Profile> activeProfiles) {
*/
@Override
public List<ModelProblem> getProblems() {
return Collections.unmodifiableList(problems);
return List.copyOf(problems);
}

/**
Expand Down

0 comments on commit 9ddd0a2

Please sign in to comment.