From fb6d998f54616825ed7715ee676774b42b717007 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 6 Dec 2024 18:59:21 +0100 Subject: [PATCH] revert parallel download of maven depedencies --- .../java/lucee/runtime/mvn/MavenUtil.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/lucee/runtime/mvn/MavenUtil.java b/core/src/main/java/lucee/runtime/mvn/MavenUtil.java index 084c950529..241da6d1b6 100644 --- a/core/src/main/java/lucee/runtime/mvn/MavenUtil.java +++ b/core/src/main/java/lucee/runtime/mvn/MavenUtil.java @@ -115,6 +115,8 @@ public static List getDependencies(List rawDependenci List dependencies = new ArrayList<>(); List parentDendencyManagement = null; + ExecutorService executor = ThreadUtil.createExecutorService(Runtime.getRuntime().availableProcessors()); + if (parent != null) { parentDendencyManagement = current.getDependencyManagement(); List tmp = parent.getDependencies(); @@ -124,17 +126,13 @@ public static List getDependencies(List rawDependenci } } } - if (rawDependencies != null && rawDependencies.size() > 0) { - + if (rawDependencies != null) { List> futures = new ArrayList<>(); - final List pdm = parentDendencyManagement; - ExecutorService executor = ThreadUtil.createExecutorService(rawDependencies.size(), true); for (POMReader.Dependency rd: rawDependencies) { + GAVSO gavso = getDependency(rd, parent, current, properties, parentDendencyManagement, management); + if (gavso == null) continue; + Future future = executor.submit(() -> { - GAVSO gavso = getDependency(rd, parent, current, properties, pdm, management); - if (gavso == null) { - return null; // Skip if no GAVSO is returned - } POM p = POM.getInstance(localDirectory, current.getRepositories(), gavso.g, gavso.a, gavso.v, gavso.s, gavso.o, current.getDependencyScope(), current.getDependencyScopeManagement(), log); p.initXML(); @@ -144,17 +142,14 @@ public static List getDependencies(List rawDependenci } try { for (Future future: futures) { - POM dependency = future.get(); // Wait for init to complete - if (dependency != null) { // Only add non-null dependencies - dependencies.add(dependency); - } + dependencies.add(future.get()); // Wait for init to complete } } catch (Exception e) { throw ExceptionUtil.toIOException(e); } - executor.shutdown(); } + executor.shutdown(); return dependencies; }