public class HttpClientUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClient()
以线程安全的方式获取线程池
|
static org.apache.http.impl.conn.PoolingHttpClientConnectionManager |
getManager() |
static int |
getMaxClientNum() |
protected static org.apache.http.pool.PoolStats |
getPoolState()
获取HTTP 链接池的状态,用于整体监控
|
static int |
getTimeOut() |
static org.apache.http.impl.client.CloseableHttpClient |
init() |
static org.apache.http.impl.client.CloseableHttpClient |
init(String hostName,
int port,
String scheme)
HTTP 链接池初始化类
|
static void |
setMaxClientNum(int maxClientNum)
httpClient 初始化后,设置无效
|
static void |
setTimeOut(int timeOut)
httpClient 初始化后,设置无效
|
public static int getMaxClientNum()
public static void setMaxClientNum(int maxClientNum)
maxClientNum - HTTP 链接池最大并发连接数public static int getTimeOut()
public static void setTimeOut(int timeOut)
timeOut - HTTP 连接超时时间protected static org.apache.http.pool.PoolStats getPoolState()
public static org.apache.http.impl.conn.PoolingHttpClientConnectionManager getManager()
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient()
public static org.apache.http.impl.client.CloseableHttpClient init()
Copyright © 2021. All rights reserved.