From 1ed030f6dfdfed2a784e7463b9e3294eda3b85cd Mon Sep 17 00:00:00 2001 From: Bryce Tompkins Date: Thu, 10 Oct 2024 13:32:32 -0400 Subject: [PATCH 1/7] Add ExecutionContext#getOnDownload to communicate long download times to consumers of MavenPomDownloader --- .../org/openrewrite/ExecutionContext.java | 6 ++++++ .../openrewrite/InMemoryExecutionContext.java | 21 ++++++++++++++++++- .../scheduling/WatchableExecutionContext.java | 8 +++++++ .../maven/internal/MavenPomDownloader.java | 12 +++++++++-- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java index 1b0f3b83a45..7ba16ac938d 100644 --- a/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java @@ -18,6 +18,8 @@ import org.jspecify.annotations.Nullable; import org.openrewrite.scheduling.RecipeRunCycle; +import java.net.URI; +import java.time.Duration; import java.util.*; import java.util.function.BiConsumer; import java.util.function.BiFunction; @@ -100,6 +102,10 @@ default void putCurrentRecipe(Recipe recipe) { BiConsumer getOnTimeout(); + default @Nullable BiConsumer getOnDownload() { + return null; + } + default int getCycle() { return getCycleDetails().getCycle(); } diff --git a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java index e3de51bc336..ba3614c3c15 100644 --- a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java @@ -17,6 +17,7 @@ import org.jspecify.annotations.Nullable; +import java.net.URI; import java.time.Duration; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -27,6 +28,8 @@ public class InMemoryExecutionContext implements ExecutionContext { private final Map messages = new ConcurrentHashMap<>(); private final Consumer onError; private final BiConsumer onTimeout; + @Nullable + private final BiConsumer onDownload; public InMemoryExecutionContext() { this( @@ -44,9 +47,19 @@ public InMemoryExecutionContext(Consumer onError, Duration runTimeout }); } - public InMemoryExecutionContext(Consumer onError, Duration runTimeout, BiConsumer onTimeout) { + public InMemoryExecutionContext(Consumer onError, + Duration runTimeout, + BiConsumer onTimeout) { + this(onError, runTimeout, onTimeout, null); + } + + public InMemoryExecutionContext(Consumer onError, + Duration runTimeout, + BiConsumer onTimeout, + @Nullable BiConsumer onDownload) { this.onError = onError; this.onTimeout = onTimeout; + this.onDownload = onDownload; putMessage(ExecutionContext.RUN_TIMEOUT, runTimeout); } @@ -80,4 +93,10 @@ public Consumer getOnError() { public BiConsumer getOnTimeout() { return onTimeout; } + + @Override + @Nullable + public BiConsumer getOnDownload() { + return onDownload; + } } diff --git a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java index 2185bb736c6..45fef9a37f1 100644 --- a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java @@ -19,6 +19,8 @@ import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; +import java.net.URI; +import java.time.Duration; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -64,4 +66,10 @@ public Consumer getOnError() { public BiConsumer getOnTimeout() { return delegate.getOnTimeout(); } + + @Override + @Nullable + public BiConsumer getOnDownload() { + return delegate.getOnDownload(); + } } diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java index 4f0a26f50bd..707162d2db5 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java @@ -55,7 +55,6 @@ import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.toList; -@SuppressWarnings("OptionalAssignedToNull") public class MavenPomDownloader { private static final RetryPolicy retryPolicy = RetryPolicy.builder() .handle(SocketTimeoutException.class, TimeoutException.class) @@ -333,7 +332,12 @@ public MavenMetadata downloadMetadata(GroupArtifactVersion gav, @Nullable Resolv .setRepositoryResponses(repositoryResponses); } - sample.stop(timer.tags("outcome", "success").register(Metrics.globalRegistry)); + long nanos = sample.stop(timer.tags("outcome", "success").register(Metrics.globalRegistry)); + if (ctx.getOnDownload() != null) { + ctx.getOnDownload().accept( + URI.create(attemptedUris.get(attemptedUris.size() - 1)), + Duration.ofNanos(nanos)); + } return mavenMetadata; } @@ -604,6 +608,10 @@ public Pom download(GroupArtifactVersion gav, mavenCache.putPom(resolvedGav, pom); ctx.getResolutionListener().downloadSuccess(resolvedGav, containingPom); sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); + long nanos = sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); + if (ctx.getOnDownload() != null) { + ctx.getOnDownload().accept(uri, Duration.ofNanos(nanos)); + } return pom; } catch (HttpSenderResponseException e) { repositoryResponses.put(repo, e.getMessage()); From 831e486b7cc616121c9705a5955417dc9a77872c Mon Sep 17 00:00:00 2001 From: Bryce Tompkins <167870666+bryceatmoderne@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:47:07 -0400 Subject: [PATCH 2/7] Update rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../main/java/org/openrewrite/InMemoryExecutionContext.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java index ba3614c3c15..f1b586541e4 100644 --- a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java @@ -95,8 +95,7 @@ public BiConsumer getOnTimeout() { } @Override - @Nullable - public BiConsumer getOnDownload() { + public @Nullable BiConsumer getOnDownload() { return onDownload; } } From efc2480c740e388def0966d87962eaa54abcfe9f Mon Sep 17 00:00:00 2001 From: Bryce Tompkins <167870666+bryceatmoderne@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:47:43 -0400 Subject: [PATCH 3/7] Update rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../org/openrewrite/scheduling/WatchableExecutionContext.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java index 45fef9a37f1..4bcb8482f81 100644 --- a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java @@ -68,8 +68,7 @@ public BiConsumer getOnTimeout() { } @Override - @Nullable - public BiConsumer getOnDownload() { + public @Nullable BiConsumer getOnDownload() { return delegate.getOnDownload(); } } From 66cbbc4ec286cf695a4e6031470a5905b28d1a54 Mon Sep 17 00:00:00 2001 From: Bryce Tompkins Date: Thu, 10 Oct 2024 14:52:24 -0400 Subject: [PATCH 4/7] Move getOnDownload to MavenExecutionContextView and rename it getOnDownloaded --- .../org/openrewrite/ExecutionContext.java | 6 ----- .../openrewrite/InMemoryExecutionContext.java | 23 ++----------------- .../scheduling/WatchableExecutionContext.java | 8 ------- .../maven/MavenExecutionContextView.java | 14 +++++++++++ .../maven/internal/MavenPomDownloader.java | 8 +++---- 5 files changed, 20 insertions(+), 39 deletions(-) diff --git a/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java index 7ba16ac938d..1b0f3b83a45 100644 --- a/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/ExecutionContext.java @@ -18,8 +18,6 @@ import org.jspecify.annotations.Nullable; import org.openrewrite.scheduling.RecipeRunCycle; -import java.net.URI; -import java.time.Duration; import java.util.*; import java.util.function.BiConsumer; import java.util.function.BiFunction; @@ -102,10 +100,6 @@ default void putCurrentRecipe(Recipe recipe) { BiConsumer getOnTimeout(); - default @Nullable BiConsumer getOnDownload() { - return null; - } - default int getCycle() { return getCycleDetails().getCycle(); } diff --git a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java index ba3614c3c15..5fb79cc3026 100644 --- a/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/InMemoryExecutionContext.java @@ -17,7 +17,6 @@ import org.jspecify.annotations.Nullable; -import java.net.URI; import java.time.Duration; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -28,8 +27,6 @@ public class InMemoryExecutionContext implements ExecutionContext { private final Map messages = new ConcurrentHashMap<>(); private final Consumer onError; private final BiConsumer onTimeout; - @Nullable - private final BiConsumer onDownload; public InMemoryExecutionContext() { this( @@ -47,19 +44,9 @@ public InMemoryExecutionContext(Consumer onError, Duration runTimeout }); } - public InMemoryExecutionContext(Consumer onError, - Duration runTimeout, - BiConsumer onTimeout) { - this(onError, runTimeout, onTimeout, null); - } - - public InMemoryExecutionContext(Consumer onError, - Duration runTimeout, - BiConsumer onTimeout, - @Nullable BiConsumer onDownload) { + public InMemoryExecutionContext(Consumer onError, Duration runTimeout, BiConsumer onTimeout) { this.onError = onError; this.onTimeout = onTimeout; - this.onDownload = onDownload; putMessage(ExecutionContext.RUN_TIMEOUT, runTimeout); } @@ -93,10 +80,4 @@ public Consumer getOnError() { public BiConsumer getOnTimeout() { return onTimeout; } - - @Override - @Nullable - public BiConsumer getOnDownload() { - return onDownload; - } -} +} \ No newline at end of file diff --git a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java index 45fef9a37f1..2185bb736c6 100644 --- a/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java +++ b/rewrite-core/src/main/java/org/openrewrite/scheduling/WatchableExecutionContext.java @@ -19,8 +19,6 @@ import org.jspecify.annotations.Nullable; import org.openrewrite.ExecutionContext; -import java.net.URI; -import java.time.Duration; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -66,10 +64,4 @@ public Consumer getOnError() { public BiConsumer getOnTimeout() { return delegate.getOnTimeout(); } - - @Override - @Nullable - public BiConsumer getOnDownload() { - return delegate.getOnDownload(); - } } diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java index 93d0109666e..4d5cddeb211 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java @@ -23,8 +23,10 @@ import org.openrewrite.maven.internal.MavenParsingException; import org.openrewrite.maven.tree.*; +import java.net.URI; import java.time.Duration; import java.util.*; +import java.util.function.BiConsumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -48,6 +50,9 @@ public class MavenExecutionContextView extends DelegatingExecutionContext { private static final String MAVEN_RESOLUTION_LISTENER = "org.openrewrite.maven.resolutionListener"; private static final String MAVEN_RESOLUTION_TIME = "org.openrewrite.maven.resolutionTime"; + @Nullable + private BiConsumer onDownloaded; + public MavenExecutionContextView(ExecutionContext delegate) { super(delegate); } @@ -238,6 +243,15 @@ public MavenExecutionContextView setMavenSettings(@Nullable MavenSettings settin return getMessage(MAVEN_SETTINGS, null); } + @Nullable + public BiConsumer getOnDownloaded() { + return onDownloaded; + } + + public void setOnDownloaded(BiConsumer onDownloaded) { + this.onDownloaded = onDownloaded; + } + private static List mapActiveProfiles(MavenSettings settings, String... activeProfiles) { if (settings.getActiveProfiles() == null) { return Arrays.asList(activeProfiles); diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java index 707162d2db5..1018d5bd01f 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java @@ -333,8 +333,8 @@ public MavenMetadata downloadMetadata(GroupArtifactVersion gav, @Nullable Resolv } long nanos = sample.stop(timer.tags("outcome", "success").register(Metrics.globalRegistry)); - if (ctx.getOnDownload() != null) { - ctx.getOnDownload().accept( + if (ctx.getOnDownloaded() != null) { + ctx.getOnDownloaded().accept( URI.create(attemptedUris.get(attemptedUris.size() - 1)), Duration.ofNanos(nanos)); } @@ -609,8 +609,8 @@ public Pom download(GroupArtifactVersion gav, ctx.getResolutionListener().downloadSuccess(resolvedGav, containingPom); sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); long nanos = sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); - if (ctx.getOnDownload() != null) { - ctx.getOnDownload().accept(uri, Duration.ofNanos(nanos)); + if (ctx.getOnDownloaded() != null) { + ctx.getOnDownloaded().accept(uri, Duration.ofNanos(nanos)); } return pom; } catch (HttpSenderResponseException e) { From 93d237e8f052e27ff9a4611155b601d57abccb7f Mon Sep 17 00:00:00 2001 From: Bryce Tompkins <167870666+bryceatmoderne@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:08:30 -0400 Subject: [PATCH 5/7] Update rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../java/org/openrewrite/maven/MavenExecutionContextView.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java index 4d5cddeb211..7a4c46967e2 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java @@ -243,9 +243,7 @@ public MavenExecutionContextView setMavenSettings(@Nullable MavenSettings settin return getMessage(MAVEN_SETTINGS, null); } - @Nullable - public BiConsumer getOnDownloaded() { - return onDownloaded; + public @Nullable BiConsumer getOnDownloaded() { } public void setOnDownloaded(BiConsumer onDownloaded) { From d8d2680fd3b41669c653a8378b8ae46afd425be0 Mon Sep 17 00:00:00 2001 From: Bryce Tompkins Date: Thu, 10 Oct 2024 15:14:26 -0400 Subject: [PATCH 6/7] Size check --- .../java/org/openrewrite/maven/internal/MavenPomDownloader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java index 1018d5bd01f..e59e6012d8e 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java @@ -333,7 +333,7 @@ public MavenMetadata downloadMetadata(GroupArtifactVersion gav, @Nullable Resolv } long nanos = sample.stop(timer.tags("outcome", "success").register(Metrics.globalRegistry)); - if (ctx.getOnDownloaded() != null) { + if (ctx.getOnDownloaded() != null && !attemptedUris.isEmpty()) { ctx.getOnDownloaded().accept( URI.create(attemptedUris.get(attemptedUris.size() - 1)), Duration.ofNanos(nanos)); From c512a12f6e4c0877dc96fcd7caed3ece83c6fdc7 Mon Sep 17 00:00:00 2001 From: Bryce Tompkins Date: Thu, 10 Oct 2024 16:26:52 -0400 Subject: [PATCH 7/7] Move logic to ResolutionEventListener --- .../maven/MavenExecutionContextView.java | 12 ------------ .../maven/internal/MavenPomDownloader.java | 15 ++++----------- .../maven/tree/ResolutionEventListener.java | 7 +++++++ 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java index 7a4c46967e2..93d0109666e 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/MavenExecutionContextView.java @@ -23,10 +23,8 @@ import org.openrewrite.maven.internal.MavenParsingException; import org.openrewrite.maven.tree.*; -import java.net.URI; import java.time.Duration; import java.util.*; -import java.util.function.BiConsumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -50,9 +48,6 @@ public class MavenExecutionContextView extends DelegatingExecutionContext { private static final String MAVEN_RESOLUTION_LISTENER = "org.openrewrite.maven.resolutionListener"; private static final String MAVEN_RESOLUTION_TIME = "org.openrewrite.maven.resolutionTime"; - @Nullable - private BiConsumer onDownloaded; - public MavenExecutionContextView(ExecutionContext delegate) { super(delegate); } @@ -243,13 +238,6 @@ public MavenExecutionContextView setMavenSettings(@Nullable MavenSettings settin return getMessage(MAVEN_SETTINGS, null); } - public @Nullable BiConsumer getOnDownloaded() { - } - - public void setOnDownloaded(BiConsumer onDownloaded) { - this.onDownloaded = onDownloaded; - } - private static List mapActiveProfiles(MavenSettings settings, String... activeProfiles) { if (settings.getActiveProfiles() == null) { return Arrays.asList(activeProfiles); diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java index e59e6012d8e..52354760b78 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/internal/MavenPomDownloader.java @@ -333,11 +333,7 @@ public MavenMetadata downloadMetadata(GroupArtifactVersion gav, @Nullable Resolv } long nanos = sample.stop(timer.tags("outcome", "success").register(Metrics.globalRegistry)); - if (ctx.getOnDownloaded() != null && !attemptedUris.isEmpty()) { - ctx.getOnDownloaded().accept( - URI.create(attemptedUris.get(attemptedUris.size() - 1)), - Duration.ofNanos(nanos)); - } + ctx.getResolutionListener().downloadMetadataSuccess(mavenMetadata, containingPom, Duration.ofNanos(nanos)); return mavenMetadata; } @@ -584,7 +580,7 @@ public Pom download(GroupArtifactVersion gav, pom = pom.withGav(pom.getGav().withDatedSnapshotVersion(versionMaybeDatedSnapshot)); } mavenCache.putPom(resolvedGav, pom); - ctx.getResolutionListener().downloadSuccess(resolvedGav, containingPom); + ctx.getResolutionListener().downloadSuccess(resolvedGav, containingPom, Duration.ZERO); sample.stop(timer.tags("outcome", "from maven local").register(Metrics.globalRegistry)); return pom; } @@ -606,12 +602,9 @@ public Pom download(GroupArtifactVersion gav, pom = pom.withGav(pom.getGav().withDatedSnapshotVersion(versionMaybeDatedSnapshot)); } mavenCache.putPom(resolvedGav, pom); - ctx.getResolutionListener().downloadSuccess(resolvedGav, containingPom); - sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); long nanos = sample.stop(timer.tags("outcome", "downloaded").register(Metrics.globalRegistry)); - if (ctx.getOnDownloaded() != null) { - ctx.getOnDownloaded().accept(uri, Duration.ofNanos(nanos)); - } + ctx.getResolutionListener() + .downloadSuccess(resolvedGav, containingPom, Duration.ofNanos(nanos)); return pom; } catch (HttpSenderResponseException e) { repositoryResponses.put(repo, e.getMessage()); diff --git a/rewrite-maven/src/main/java/org/openrewrite/maven/tree/ResolutionEventListener.java b/rewrite-maven/src/main/java/org/openrewrite/maven/tree/ResolutionEventListener.java index baee1173528..c6559cc75ca 100644 --- a/rewrite-maven/src/main/java/org/openrewrite/maven/tree/ResolutionEventListener.java +++ b/rewrite-maven/src/main/java/org/openrewrite/maven/tree/ResolutionEventListener.java @@ -17,6 +17,7 @@ import org.jspecify.annotations.Nullable; +import java.time.Duration; import java.util.List; @SuppressWarnings("unused") @@ -33,9 +34,15 @@ default void downloadMetadata(GroupArtifactVersion gav) { default void download(GroupArtifactVersion gav) { } + default void downloadMetadataSuccess(MavenMetadata mavenMetadata, @Nullable ResolvedPom containing, Duration duration) { + } + default void downloadSuccess(ResolvedGroupArtifactVersion gav, @Nullable ResolvedPom containing) { } + default void downloadSuccess(ResolvedGroupArtifactVersion gav, @Nullable ResolvedPom containing, Duration duration) { + } + /** * @param gav - GAV coordinate of the dependency which failed to download * @param attemptedUris - The URIs which were attempted, in the order they were attempted, before resolution was determined to have failed