@Override protected CloseableHttpAsyncClient newClient() { CloseableHttpAsyncClient result = HttpAsyncClients.custom().build(); result.start(); return result; }
/** * Create a new instance of the {@code HttpComponentsAsyncClientHttpRequestFactory} * with a default {@link HttpAsyncClient} and {@link HttpClient}. */ public HttpComponentsAsyncClientHttpRequestFactory() { super(); this.asyncClient = HttpAsyncClients.createSystem(); }
public EtcdClientImpl(String uri) { mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); client = HttpAsyncClients.createDefault(); client.start(); if(!uri.endsWith("/")) { uri += "/"; } baseUri = URI.create(uri); }
public HttpRpcClient(String serverUrl){ this.serverUrl = serverUrl; this.httpClient = HttpAsyncClients.createDefault(); this.gson = new GsonBuilder().create(); this.logger = LogManager.getLogger(getClass()); }
public MetricFetcher() { int cores = Runtime.getRuntime().availableProcessors() * 2; long keepAliveTime = 0; int queueSize = 2048; RejectedExecutionHandler handler = new DiscardPolicy(); fetchService = new ThreadPoolExecutor(cores, cores, keepAliveTime, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(queueSize), new NamedThreadFactory("sentinel-dashboard-metrics-fetchService"), handler); fetchWorker = new ThreadPoolExecutor(cores, cores, keepAliveTime, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(queueSize), new NamedThreadFactory("sentinel-dashboard-metrics-fetchWorker"), handler); IOReactorConfig ioConfig = IOReactorConfig.custom() .setConnectTimeout(3000) .setSoTimeout(3000) .setIoThreadCount(Runtime.getRuntime().availableProcessors() * 2) .build(); httpclient = HttpAsyncClients.custom() .setRedirectStrategy(new DefaultRedirectStrategy() { @Override protected boolean isRedirectable(final String method) { return false; } }).setMaxConnTotal(4000) .setMaxConnPerRoute(1000) .setDefaultIOReactorConfig(ioConfig) .build(); httpclient.start(); start(); }
public HttpRpcClient(String serverUrl){ this.serverUrl = serverUrl; this.httpClient = HttpAsyncClients.createDefault(); this.gson = new GsonBuilder().create(); this.logger = LogManager.getLogger(getClass()); }
/** * Create a new instance of the {@code HttpComponentsAsyncClientHttpRequestFactory} * with a default {@link HttpAsyncClient} and {@link HttpClient}. */ public HttpComponentsAsyncClientHttpRequestFactory() { super(); this.asyncClient = HttpAsyncClients.createSystem(); }
public SentinelApiClient() { IOReactorConfig ioConfig = IOReactorConfig.custom().setConnectTimeout(3000).setSoTimeout(10000) .setIoThreadCount(Runtime.getRuntime().availableProcessors() * 2).build(); httpClient = HttpAsyncClients.custom().setRedirectStrategy(new DefaultRedirectStrategy() { @Override protected boolean isRedirectable(final String method) { return false; } }).setMaxConnTotal(4000).setMaxConnPerRoute(1000).setDefaultIOReactorConfig(ioConfig).build(); httpClient.start(); }
public static HttpClient create() { return ApacheHttpClientAdapter.of(HttpAsyncClients.createDefault()); }
public ResteasyClientBuilderImpl useAsyncHttpEngine() { this.httpEngine = new ApacheHttpAsyncClient4Engine(HttpAsyncClients.createSystem(), true); return this; }
private void setupAsyncClient() { final HttpAsyncClientBuilder clientBuilder = HttpAsyncClients.custom(); if (sslContext != null) { clientBuilder.setSSLContext(sslContext); clientBuilder.addInterceptorFirst(new HttpsResponseInterceptor()); } httpAsyncClient = clientBuilder.setDefaultCredentialsProvider(getCredentialsProvider()).build(); httpAsyncClient.start(); }
public HttpPostDeliverService(final String postUrl, final int connectTimeout, final int soTimeout) { httpClient = HttpAsyncClients.createDefault(); httpClient.start(); httpPost = new HttpPost(postUrl); final RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(connectTimeout).setSocketTimeout(soTimeout).build(); httpPost.setConfig(requestConfig); httpPost.setHeader("Content-type", "application/json"); httpPost.setHeader("Content-Type", "text/html;charset=UTF-8"); }
/** * Create a new instance of the {@code HttpComponentsAsyncClientHttpRequestFactory} * with a default {@link HttpAsyncClient} and {@link HttpClient}. */ public HttpComponentsAsyncClientHttpRequestFactory() { super(); this.asyncClient = HttpAsyncClients.createSystem(); }
private CloseableHttpAsyncClient createAsyncHttpClient(NHttpClientConnectionManager connectionManager) { return configureHttpClient( HttpAsyncClients.custom() .setConnectionManager(connectionManager) .setDefaultRequestConfig(getRequestConfig()) .setProxyAuthenticationStrategy(httpClientConfig.getProxyAuthenticationStrategy()) .setRoutePlanner(getRoutePlanner()) .setDefaultCredentialsProvider(httpClientConfig.getCredentialsProvider()) ).build(); }
public static HttpClient create() { return ApacheHttpClientAdapter.of(HttpAsyncClients.createDefault()); }
/** * Create a new instance of the {@code HttpComponentsAsyncClientHttpRequestFactory} * with a default {@link HttpAsyncClient} and {@link HttpClient}. */ public HttpComponentsAsyncClientHttpRequestFactory() { super(); this.asyncClient = HttpAsyncClients.createSystem(); }
HttpAsyncClientBuilder builder = HttpAsyncClients.custom() .setThreadFactory(new RapidoidThreadFactory("http-client", true)) .disableConnectionState()
/** * Create Olingo2 Application with custom HTTP client builder. * * @param serviceUri Service Application base URI. * @param builder custom HTTP client builder. */ public Olingo2AppImpl(String serviceUri, HttpAsyncClientBuilder builder) { setServiceUri(serviceUri); if (builder == null) { this.client = HttpAsyncClients.createDefault(); } else { this.client = builder.build(); } this.client.start(); this.contentType = ContentType.create("application/json", Consts.UTF_8); }
public ResteasyClientBuilder useAsyncHttpEngine() { this.httpEngine = new ApacheHttpAsyncClient4Engine(HttpAsyncClients.createSystem(), true); return this; }
.build(); HttpAsyncClientBuilder client = HttpAsyncClients.custom() .setDefaultCookieStore(new BasicCookieStore()) .setSSLContext(sslContext)