Merge pull request #8756 from janvojt/fix/jetty-10-npe-with-destination-idle-timeout

Issue #8753 - Fix HttpClient initialization with destinationIdleTimeout set.
This commit is contained in:
Simone Bordet 2022-10-22 15:09:36 +02:00 committed by GitHub
commit a6afbaf470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -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));