json.put("maxHeaderSize", obj.getMaxHeaderSize()); json.put("maxInitialLineLength", obj.getMaxInitialLineLength()); json.put("maxPoolSize", obj.getMaxPoolSize()); json.put("maxRedirects", obj.getMaxRedirects()); json.put("maxWaitQueueSize", obj.getMaxWaitQueueSize());
while (true) { Endpoint endpoint = endpointMap.computeIfAbsent(key, targetAddress -> { int maxPoolSize = Math.max(client.getOptions().getMaxPoolSize(), client.getOptions().getHttp2MaxPoolSize()); Object metric = metrics != null ? metrics.createEndpoint(host, port, maxPoolSize) : null; HttpChannelConnector connector = new HttpChannelConnector(client, metric, version, ssl, peerHost, host, port);
HttpChannelConnector(HttpClientImpl client, Object endpointMetric, HttpVersion version, boolean ssl, String peerHost, String host, int port) { this.client = client; this.endpointMetric = endpointMetric; this.options = client.getOptions(); this.metrics = client.metrics(); this.sslHelper = client.getSslHelper(); this.version = version; // this is actually normal (although it sounds weird) // the pool uses a weight mechanism to keep track of the max number of connections // for instance when http2Size = 2 and http1Size= 5 then maxWeight = 10 // which means that the pool can contain // - maxWeight / http1Weight = 5 HTTP/1.1 connections // - maxWeight / http2Weight = 2 HTTP/2 connections this.http1Weight = options.getHttp2MaxPoolSize(); this.http2Weight = options.getMaxPoolSize(); this.weight = version == HttpVersion.HTTP_2 ? http2Weight : http1Weight; this.http1MaxConcurrency = options.isPipelining() ? options.getPipeliningLimit() : 1; this.ssl = ssl; this.peerHost = peerHost; this.host = host; this.port = port; }
throw new IllegalStateException("Cannot have pipelining with no keep alive"); long maxWeight = options.getMaxPoolSize() * options.getHttp2MaxPoolSize(); websocketCM = new ConnectionManager(this, metrics, HttpVersion.HTTP_1_1, maxWeight, options.getMaxWaitQueueSize());
super(other); this.verifyHost = other.isVerifyHost(); this.maxPoolSize = other.getMaxPoolSize(); this.keepAlive = other.isKeepAlive(); this.keepAliveTimeout = other.getKeepAliveTimeout();
assertEquals(crlPath, options.getCrlPaths().get(0)); assertEquals(verifyHost, options.isVerifyHost()); assertEquals(maxPoolSize, options.getMaxPoolSize()); assertEquals(keepAlive, options.isKeepAlive()); assertEquals(pipelining, options.isPipelining());
assertEquals(options.getCrlValues().get(0), copy.getCrlValues().get(0)); assertEquals(options.isVerifyHost(), copy.isVerifyHost()); assertEquals(options.getMaxPoolSize(), copy.getMaxPoolSize()); assertEquals(options.isKeepAlive(), copy.isKeepAlive()); assertEquals(options.isPipelining(), copy.isPipelining());
json.put("maxHeaderSize", obj.getMaxHeaderSize()); json.put("maxInitialLineLength", obj.getMaxInitialLineLength()); json.put("maxPoolSize", obj.getMaxPoolSize()); json.put("maxRedirects", obj.getMaxRedirects()); json.put("maxWaitQueueSize", obj.getMaxWaitQueueSize());
while (true) { Endpoint endpoint = endpointMap.computeIfAbsent(key, targetAddress -> { int maxPoolSize = Math.max(client.getOptions().getMaxPoolSize(), client.getOptions().getHttp2MaxPoolSize()); Object metric = metrics != null ? metrics.createEndpoint(host, port, maxPoolSize) : null; HttpChannelConnector connector = new HttpChannelConnector(client, metric, version, ssl, peerHost, host, port);
HttpClientOptions def = new HttpClientOptions(); HttpClientOptions json = new HttpClientOptions(new JsonObject()); assertEquals(def.getMaxPoolSize(), json.getMaxPoolSize()); assertEquals(def.isKeepAlive(), json.isKeepAlive()); assertEquals(def.isPipelining(), json.isPipelining());
HttpChannelConnector(HttpClientImpl client, Object endpointMetric, HttpVersion version, boolean ssl, String peerHost, String host, int port) { this.client = client; this.endpointMetric = endpointMetric; this.options = client.getOptions(); this.metrics = client.metrics(); this.sslHelper = client.getSslHelper(); this.version = version; // this is actually normal (although it sounds weird) // the pool uses a weight mechanism to keep track of the max number of connections // for instance when http2Size = 2 and http1Size= 5 then maxWeight = 10 // which means that the pool can contain // - maxWeight / http1Weight = 5 HTTP/1.1 connections // - maxWeight / http2Weight = 2 HTTP/2 connections this.http1Weight = options.getHttp2MaxPoolSize(); this.http2Weight = options.getMaxPoolSize(); this.weight = version == HttpVersion.HTTP_2 ? http2Weight : http1Weight; this.http1MaxConcurrency = options.isPipelining() ? options.getPipeliningLimit() : 1; this.ssl = ssl; this.peerHost = peerHost; this.host = host; this.port = port; }
", IdleTimeout='" + httpClientOptions.getIdleTimeout() + '\'' + ", MaxChunkSize='" + httpClientOptions.getMaxChunkSize() + '\'' + ", MaxPoolSize='" + httpClientOptions.getMaxPoolSize() + '\'' + ", MaxWaitQueueSize='" + httpClientOptions.getMaxWaitQueueSize() + '\'' + ", Pipelining='" + httpClientOptions.isPipelining() + '\'' +
throw new IllegalStateException("Cannot have pipelining with no keep alive"); long maxWeight = options.getMaxPoolSize() * options.getHttp2MaxPoolSize(); websocketCM = new ConnectionManager(this, metrics, HttpVersion.HTTP_1_1, maxWeight, options.getMaxWaitQueueSize());
super(other); this.verifyHost = other.isVerifyHost(); this.maxPoolSize = other.getMaxPoolSize(); this.keepAlive = other.isKeepAlive(); this.keepAliveTimeout = other.getKeepAliveTimeout();
assertFalse(options.isVerifyHost()); assertEquals(5, options.getMaxPoolSize()); rand = TestUtils.randomPositiveInt(); assertEquals(options, options.setMaxPoolSize(rand)); assertEquals(rand, options.getMaxPoolSize()); assertIllegalArgumentException(() -> options.setMaxPoolSize(0)); assertIllegalArgumentException(() -> options.setMaxPoolSize(-1));
assertEquals(crlPath, options.getCrlPaths().get(0)); assertEquals(verifyHost, options.isVerifyHost()); assertEquals(maxPoolSize, options.getMaxPoolSize()); assertEquals(keepAlive, options.isKeepAlive()); assertEquals(pipelining, options.isPipelining());
HttpClientMetricsImpl(VertxMetricsImpl owner, HttpClientReporter clientReporter, HttpClientOptions options, List<Match> monitoredUris, List<Match> monitoredEndpoints) { super(clientReporter.registry, clientReporter.baseName); this.owner = owner; this.clientReporter = clientReporter; this.uriMatcher = new Matcher(monitoredUris); this.endpointMatcher = new Matcher(monitoredEndpoints); clientReporter.incMaxPoolSize(maxPoolSize = options.getMaxPoolSize()); }
assertEquals(options.getCrlValues().get(0), copy.getCrlValues().get(0)); assertEquals(options.isVerifyHost(), copy.isVerifyHost()); assertEquals(options.getMaxPoolSize(), copy.getMaxPoolSize()); assertEquals(options.isKeepAlive(), copy.isKeepAlive()); assertEquals(options.isPipelining(), copy.isPipelining());
HttpClientOptions def = new HttpClientOptions(); HttpClientOptions json = new HttpClientOptions(new JsonObject()); assertEquals(def.getMaxPoolSize(), json.getMaxPoolSize()); assertEquals(def.isKeepAlive(), json.isKeepAlive()); assertEquals(def.isPipelining(), json.isPipelining());
assertFalse(options.isVerifyHost()); assertEquals(5, options.getMaxPoolSize()); rand = TestUtils.randomPositiveInt(); assertEquals(options, options.setMaxPoolSize(rand)); assertEquals(rand, options.getMaxPoolSize()); assertIllegalArgumentException(() -> options.setMaxPoolSize(0)); assertIllegalArgumentException(() -> options.setMaxPoolSize(-1));