diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java index 8797fda72e0..dffcd031a43 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java @@ -39,7 +39,6 @@ import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.util.SocketAddressResolver; -import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.Scheduler; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ArgumentsSource; @@ -50,12 +49,11 @@ public class ValidatingConnectionPoolTest extends AbstractHttpClientServerTest public HttpClient newHttpClient(Scenario scenario, HttpClientTransport transport, Executor executor, Scheduler scheduler, SocketAddressResolver resolver) { if (transport==null) - { - long timeout = 1000; transport = new HttpClientTransportOverHTTP(1); - transport.setConnectionPoolFactory(destination -> + + long timeout = 1000; + transport.setConnectionPoolFactory(destination -> new ValidatingConnectionPool(destination, destination.getHttpClient().getMaxConnectionsPerDestination(), destination, destination.getHttpClient().getScheduler(), timeout)); - } return super.newHttpClient(scenario, transport, executor, scheduler, resolver); } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslSelectionDump.java b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslSelectionDump.java index 53bad5acae2..e19355ed3e7 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslSelectionDump.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslSelectionDump.java @@ -27,10 +27,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.Dumpable; -class SslSelectionDump extends ContainerLifeCycle implements Dumpable +class SslSelectionDump implements Dumpable { static class CaptionedList extends ArrayList implements Dumpable { @@ -66,9 +65,7 @@ class SslSelectionDump extends ContainerLifeCycle implements Dumpable String[] includedByConfig) { this.type = type; - addBean(enabled); - addBean(disabled); - + List jvmEnabled = Arrays.asList(enabledByJVM); List excludedPatterns = Arrays.stream(excludedByConfig) .map((entry) -> Pattern.compile(entry)) @@ -165,7 +162,7 @@ class SslSelectionDump extends ContainerLifeCycle implements Dumpable @Override public void dump(Appendable out, String indent) throws IOException { - dumpObjects(out, indent); + Dumpable.dumpObjects(out, indent, this, enabled, disabled); } @Override diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java index 814d9bd011b..471e74aba53 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java @@ -18,6 +18,9 @@ package org.eclipse.jetty.http.client; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.io.InterruptedIOException; import java.nio.ByteBuffer; @@ -65,9 +68,6 @@ import org.hamcrest.Matchers; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ArgumentsSource; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class HttpClientLoadTest extends AbstractTest { private final Logger logger = Log.getLogger(HttpClientLoadTest.class); @@ -85,11 +85,12 @@ public class HttpClientLoadTest extends AbstractTest + { + client.setByteBufferPool(new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged())); + client.setMaxConnectionsPerDestination(32768); + client.setMaxRequestsQueuedPerDestination(1024 * 1024); + }); // At least 25k requests to warmup properly (use -XX:+PrintCompilation to verify JIT activity) int runs = 1; @@ -130,11 +131,13 @@ public class HttpClientLoadTest extends AbstractTest + { + client.setByteBufferPool(new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged())); + client.setMaxConnectionsPerDestination(32768); + client.setMaxRequestsQueuedPerDestination(1024 * 1024); + }); - scenario.client.setByteBufferPool(new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged())); - scenario.client.setMaxConnectionsPerDestination(32768); - scenario.client.setMaxRequestsQueuedPerDestination(1024 * 1024); int runs = 1; int iterations = 256; diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java index 174c1e51f1c..d66e883ca4f 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/TransportScenario.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.concurrent.BlockingQueue; +import java.util.function.Consumer; import javax.servlet.http.HttpServlet; @@ -270,20 +271,29 @@ public class TransportScenario else setConnectionIdleTimeout(idleTimeout); } - public void start(Handler handler) throws Exception + { + start(handler,null); + } + + public void start(Handler handler, Consumer config) throws Exception { startServer(handler); - startClient(); + startClient(config); } public void start(HttpServlet servlet) throws Exception { startServer(servlet); - startClient(); + startClient(null); } public void startClient() throws Exception + { + startClient(null); + } + + public void startClient(Consumer config) throws Exception { QueuedThreadPool clientThreads = new QueuedThreadPool(); clientThreads.setName("client"); @@ -291,6 +301,10 @@ public class TransportScenario client = newHttpClient(provideClientTransport(transport), sslContextFactory); client.setExecutor(clientThreads); client.setSocketAddressResolver(new SocketAddressResolver.Sync()); + + if (config!=null) + config.accept(client); + client.start(); if (server != null) server.addBean(client);