From 1f8b0c75a43ce678efc01652be5314d311ff9071 Mon Sep 17 00:00:00 2001 From: Jan Vojt Date: Fri, 21 Oct 2022 13:41:42 +0200 Subject: [PATCH] Issue #8753 - Fix HttpClient initialization with destinationIdleTimeout set. Signed-off-by: Jan Vojt --- .../main/java/org/eclipse/jetty/client/HttpClient.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index d6a829626f7..c1a7b433a63 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -195,7 +195,8 @@ public class HttpClient extends ContainerLifeCycle { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); - setExecutor(threadPool); + executor = threadPool; + setExecutor(executor); } int maxBucketSize = executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool)executor).getMaxThreads() / 2 @@ -207,10 +208,13 @@ public class HttpClient extends ContainerLifeCycle addBean(new ArrayRetainableByteBufferPool(0, 2048, 65536, maxBucketSize)); Scheduler scheduler = getScheduler(); if (scheduler == null) - setScheduler(new ScheduledExecutorScheduler(name + "-scheduler", false)); + { + scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); + setScheduler(scheduler); + } if (resolver == null) - setSocketAddressResolver(new SocketAddressResolver.Async(getExecutor(), getScheduler(), getAddressResolutionTimeout())); + setSocketAddressResolver(new SocketAddressResolver.Async(getExecutor(), scheduler, getAddressResolutionTimeout())); handlers.put(new ContinueProtocolHandler()); handlers.put(new RedirectProtocolHandler(this));