Skip to content

Commit

Permalink
store downloads first in temp file and then rename and load maven dow…
Browse files Browse the repository at this point in the history
…nloads again in parallel
  • Loading branch information
michaeloffner committed Dec 20, 2024
1 parent 0c1ef20 commit 5ae46f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/lucee/runtime/mvn/MavenUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,16 +381,18 @@ public static void download(POM pom, Collection<Repository> repositories, String
if (entity != null) {
Exception ex = null;
InputStream is = null;
Resource tmp = SystemUtil.getTempFile(type, false);
try {
is = entity.getContent();
IOUtil.copy(is, res, false);
IOUtil.copy(is, tmp, false);
}
catch (IOException e) {
ex = e;
}
finally {
IOUtil.closeEL(is);
HTTPUtil.validateDownload(url, response, res, true, ex);
HTTPUtil.validateDownload(url, response, tmp, true, ex);
tmp.moveTo(res);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/mvn/POM.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public List<POM> getAllDependencies() throws IOException {
return list;
}

private static TreeNode<POM> getDependencies(POM pom, boolean recursive, int level, TreeNode<POM> node) throws IOException {
private static TreeNode<POM> getDependenciesSerial(POM pom, boolean recursive, int level, TreeNode<POM> node) throws IOException {
try {
List<POM> deps = pom.getDependencies();
if (deps != null) {
Expand All @@ -491,7 +491,7 @@ private static TreeNode<POM> getDependencies(POM pom, boolean recursive, int lev
}
}

private static TreeNode<POM> getDependenciesAsync(POM pom, boolean recursive, int level, TreeNode<POM> node) throws IOException {
private static TreeNode<POM> getDependencies(POM pom, boolean recursive, int level, TreeNode<POM> node) throws IOException {
ExecutorService executor = null;
try {
List<POM> deps = pom.getDependencies();
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.239-SNAPSHOT"/>
<property name="version" value="6.2.0.240-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.239-SNAPSHOT</version>
<version>6.2.0.240-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 5ae46f5

Please sign in to comment.