Java Code Examples for io.vertx.core.http.HttpClientOptions#setMaxPoolSize()
The following examples show how to use
io.vertx.core.http.HttpClientOptions#setMaxPoolSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpClientOptionsSPI.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
static HttpClientOptions createHttpClientOptions(HttpClientOptionsSPI spi) { HttpClientOptions httpClientOptions = new HttpClientOptions(); httpClientOptions.setProtocolVersion(spi.getHttpVersion()); httpClientOptions.setConnectTimeout(spi.getConnectTimeoutInMillis()); httpClientOptions.setIdleTimeout(spi.getIdleTimeoutInSeconds()); httpClientOptions.setTryUseCompression(spi.isTryUseCompression()); httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize()); httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize()); httpClientOptions.setKeepAlive(spi.isKeepAlive()); httpClientOptions.setMaxHeaderSize(spi.getMaxHeaderSize()); httpClientOptions.setKeepAliveTimeout(spi.getKeepAliveTimeout()); if (spi.isProxyEnable()) { ProxyOptions proxy = new ProxyOptions(); proxy.setHost(spi.getProxyHost()); proxy.setPort(spi.getProxyPort()); proxy.setUsername(spi.getProxyUsername()); proxy.setPassword( Encryptions.decode(spi.getProxyPassword(), spi.getConfigTag())); httpClientOptions.setProxyOptions(proxy); } if (spi.getHttpVersion() == HttpVersion.HTTP_2) { httpClientOptions.setHttp2ClearTextUpgrade(false); httpClientOptions.setUseAlpn(spi.isUseAlpn()); httpClientOptions.setHttp2MultiplexingLimit(spi.getHttp2MultiplexingLimit()); httpClientOptions.setHttp2MaxPoolSize(spi.getHttp2MaxPoolSize()); } if (spi.isSsl()) { VertxTLSBuilder.buildHttpClientOptions(spi.getConfigTag(), httpClientOptions); } return httpClientOptions; }
Example 2
Source File: ProxyService.java From okapi with Apache License 2.0 | 5 votes |
/** * Construct Proxy service. * @param vertx Vert.x handle * @param modules module manager * @param tm tenant manager * @param dm discovery manager * @param im internal module * @param okapiUrl Okapi URL * @param config configuration */ public ProxyService(Vertx vertx, ModuleManager modules, TenantManager tm, DiscoveryManager dm, InternalModule im, String okapiUrl, JsonObject config) { this.vertx = vertx; this.moduleManager = modules; this.tenantManager = tm; this.internalModule = im; this.discoveryManager = dm; this.okapiUrl = okapiUrl; this.waitMs = config.getInteger("logWaitMs", 0); HttpClientOptions opt = new HttpClientOptions(); opt.setMaxPoolSize(1000); httpClient = vertx.createHttpClient(opt); }
Example 3
Source File: VertxHttp11ClientReconnectTest.java From feign-vertx with Apache License 2.0 | 5 votes |
/** * Create a Feign Vertx client that is built once and used several times * during positive and negative test cases. * @param context */ @Before public void before(TestContext context) { // for HTTP 1.1 test, set up the pool size to 3. Then in the server side, there should be only 3 connections created per client. HttpClientOptions options = new HttpClientOptions(); options.setMaxPoolSize(3); client = VertxFeign .builder() .vertx(this.vertx) .options(options) .encoder(new JacksonEncoder()) .decoder(new JacksonDecoder()) .target(HelloServiceAPI.class, "http://localhost:8091"); }