From fa38868406f8caee3aea6b19f99842bd030429ba Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 13 Nov 2018 10:37:42 +0100 Subject: [PATCH] use setters from doStart Signed-off-by: Greg Wilkins --- .../org/eclipse/jetty/client/HttpClient.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 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 9179a8d30e3..b8b0af8da08 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 @@ -218,27 +218,20 @@ public class HttpClient extends ContainerLifeCycle { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); - executor = threadPool; - addBean(executor); + setExecutor(threadPool); } if (byteBufferPool == null) - { - byteBufferPool = new MappedByteBufferPool(2048, + setByteBufferPool(new MappedByteBufferPool(2048, executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool)executor).getMaxThreads() / 2 - : ProcessorUtils.availableProcessors() * 2); - addBean(byteBufferPool); - } + : ProcessorUtils.availableProcessors() * 2)); if (scheduler == null) setScheduler(new ScheduledExecutorScheduler(name + "-scheduler", false)); if (resolver == null) - { - resolver = new SocketAddressResolver.Async(executor, scheduler, getAddressResolutionTimeout()); - addBean(resolver); - } + setSocketAddressResolver(new SocketAddressResolver.Async(executor, scheduler, getAddressResolutionTimeout())); handlers.put(new ContinueProtocolHandler()); handlers.put(new RedirectProtocolHandler(this)); @@ -652,7 +645,7 @@ public class HttpClient extends ContainerLifeCycle */ public void setByteBufferPool(ByteBufferPool byteBufferPool) { - if (isRunning()) + if (isStarted()) throw new IllegalStateException(getState()); updateBean(this.byteBufferPool, byteBufferPool); this.byteBufferPool = byteBufferPool; @@ -806,7 +799,7 @@ public class HttpClient extends ContainerLifeCycle */ public void setExecutor(Executor executor) { - if (isRunning()) + if (isStarted()) throw new IllegalStateException(getState()); updateBean(this.executor, executor); this.executor = executor; @@ -844,7 +837,7 @@ public class HttpClient extends ContainerLifeCycle */ public void setSocketAddressResolver(SocketAddressResolver resolver) { - if (isRunning()) + if (isStarted()) throw new IllegalStateException(getState()); updateBean(this.resolver, resolver); this.resolver = resolver;