Skip to content

common中的http连接池初始化逻辑有问题,PoolingHttpClientConnectionManager反复初始化 #107

Description

@Aron1995

common中的http连接池初始化逻辑有问题,日志中持续输出(Initialize the PoolingHttpClientConnectionManager -- maxTotal:100, defaultMaxPerRoute:50)

以下条件在代码中不成立,导致反复初始化:
`public CloseableHttpClient getHttpClient() {
if (null != httpClient) {
return httpClient;
}
if (null == configStorage) {
return httpClient = HttpClients.createDefault();
}

    CloseableHttpClient httpClient = HttpClients
            .custom()
            //网络提供者
            .setDefaultCredentialsProvider(createCredentialsProvider(configStorage))
            .setConnectionManager(connectionManager(configStorage))
            //设置httpclient的SSLSocketFactory
            .setSSLSocketFactory(createSSL(configStorage))
            .setDefaultRequestConfig(createRequestConfig(configStorage))
            .build();
    if (null == connectionManager) {
        return this.httpClient = httpClient;
    }

    return httpClient;

}`

对connectionManager判断为null才更新client并返回的逻辑请确认是否存在问题

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions