Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Aron1995 opened this issue May 15, 2024 · 0 comments

Comments

@Aron1995
Copy link

Aron1995 commented May 15, 2024

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并返回的逻辑请确认是否存在问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant