From 25b88f3f8b18cede6ed2b6492d8ed94e659d5cac Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 5 Jul 2023 23:47:56 -0700 Subject: [PATCH] use the default HttpClient executor in DependencyDownloader (HttpClient *really* doesn't want to be used synchronously) by reusing the HttpClient we still avoid redundant threads, we just can't reuse the thread making the request for handling it --- .../net/draycia/carbon/common/util/DependencyDownloader.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/src/main/java/net/draycia/carbon/common/util/DependencyDownloader.java b/common/src/main/java/net/draycia/carbon/common/util/DependencyDownloader.java index 78e821f1..d228c7db 100644 --- a/common/src/main/java/net/draycia/carbon/common/util/DependencyDownloader.java +++ b/common/src/main/java/net/draycia/carbon/common/util/DependencyDownloader.java @@ -67,10 +67,7 @@ public final class DependencyDownloader { ) { this.logger = logger; this.cacheDir = cacheDir; - this.client = HttpClient.newBuilder() - // using a cached thread pool (default) is completely redundant with how we use the client - .executor(Runnable::run) - .build(); + this.client = HttpClient.newHttpClient(); } public Set resolve() {