Skip to content

Commit

Permalink
Removes parallelStream use with non-thread safe terminators
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejj0 authored and slawekjaranowski committed Dec 17, 2022
1 parent 6619919 commit ad76411
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public ArtifactVersions lookupArtifactVersions(
.getRemoteProjectRepositories(),
"lookupArtifactVersions"))
.getVersions()
.parallelStream()
.stream()
.filter(v -> ignoredVersions.stream().noneMatch(i -> {
if (TYPE_REGEX.equals(i.getType())
&& Pattern.compile(i.getVersion())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Set<Dependency> extractPluginDependenciesFromPluginsInPluginManage
* or an empty set if none have been retrieveddependencies or an empty set if none have been retrieved
*/
public static Set<Dependency> extractDependenciesFromPlugins(MavenProject project) {
return project.getBuildPlugins().parallelStream()
return project.getBuildPlugins().stream()
.filter(plugin -> plugin.getDependencies() != null)
.flatMap(plugin -> plugin.getDependencies().stream())
.collect(() -> new TreeSet<>(DependencyComparator.INSTANCE), Set::add, Set::addAll);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private static VersionsHelper createVersionsHelper(
return new DefaultVersionsHelper.Builder()
.withRepositorySystem(ruleHelper.getComponent(RepositorySystem.class))
.withAetherRepositorySystem(ruleHelper.getComponent(org.eclipse.aether.RepositorySystem.class))
.withWagonMap(ruleHelper.getComponentMap(Wagon.class.getName()).entrySet().parallelStream()
.withWagonMap(ruleHelper.getComponentMap(Wagon.class.getName()).entrySet().stream()
.filter(e -> e.getValue() instanceof Wagon)
.collect(HashMap::new, (m, e) -> m.put(e.getKey(), (Wagon) e.getValue()), HashMap::putAll))
.withServerId(serverId)
Expand Down Expand Up @@ -349,7 +349,7 @@ public void execute(EnforcerRuleHelper ruleHelper) throws EnforcerRuleException
? of(SUBINCREMENTAL)
: ignoreIncrementalUpdates ? of(INCREMENTAL) : ignoreMinorUpdates ? of(MINOR) : empty();
List<ArtifactVersions> upgradable =
versionsHelper.lookupDependenciesUpdates(dependencies, false).values().parallelStream()
versionsHelper.lookupDependenciesUpdates(dependencies, false).values().stream()
.filter(v -> v.getVersions(v.restrictionForIgnoreScope(ignoredSegment), true).length > 0)
.collect(Collectors.toList());
if (upgradable.size() > maxUpdates) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getHelper()
.lookupDependenciesUpdates(
filterDependencies(
getProject().getDependencies().parallelStream()
.filter(dep -> finalDependencyManagement.parallelStream()
getProject().getDependencies().stream()
.filter(dep -> finalDependencyManagement.stream()
.noneMatch(depMan -> dependenciesMatch(dep, depMan)))
.collect(
() -> new TreeSet<>(DependencyComparator.INSTANCE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ private static boolean getPluginInherited(Object plugin) {
* @since 1.0-alpha-1
*/
private Map<String, Plugin> getLifecyclePlugins(MavenProject project) throws MojoExecutionException {
return getBoundPlugins(project).parallelStream()
return getBoundPlugins(project).stream()
.filter(Objects::nonNull)
.filter(p -> p.getKey() != null)
.collect(HashMap<String, Plugin>::new, (m, p) -> m.put(p.getKey(), p), Map::putAll);
Expand All @@ -874,7 +874,7 @@ private Map<String, Plugin> getLifecyclePlugins(MavenProject project) throws Moj
private Set<Plugin> getBoundPlugins(MavenProject project) {
// we need to provide a copy with the version blanked out so that inferring from super-pom
// works as for 2.x as 3.x fills in the version on us!
return lifecycleExecutor.getPluginsBoundByDefaultToAllLifecycles(project.getPackaging()).parallelStream()
return lifecycleExecutor.getPluginsBoundByDefaultToAllLifecycles(project.getPackaging()).stream()
.map(p -> new Plugin() {
{
setGroupId(p.getGroupId());
Expand Down

0 comments on commit ad76411

Please sign in to comment.