es java 连接池_httpclient连接池在ES Restful API请求中的应用

package com.wm.utils;

import org.apache.http.impl.client.CloseableHttpClient;

import org.apache.http.impl.client.HttpClients;

import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;

/**

* 1.功能:http连接池

*/

public class HttpPoolManager {

public static PoolingHttpClientConnectionManager clientConnectionManager = null;

private int maxTotal = 50;

private int defaultMaxPerRoute = 25;

private HttpPoolManager(int maxTotal, int defaultMaxPerRoute) {

this.maxTotal = maxTotal;

this.defaultMaxPerRoute = defaultMaxPerRoute;

clientConnectionManager.setMaxTotal(maxTotal);

clientConnectionManager.setDefaultMaxPerRoute(defaultMaxPerRoute);

}

private HttpPoolManager() {

clientConnectionManager.setMaxTotal(maxTotal);

clientConnectionManager

你可能感兴趣的:(es,java,连接池)