HttpClientError: The target server failed to respond

前端 未结 2 1026
南方客
南方客 2020-12-29 10:12

I am trying to hit a server using http client using PoolingClientConnectionManager setting max connections for individual hosts

 //Code that ini         


        
2条回答
  •  自闭症患者
    2020-12-29 10:24

    Recently faced similar while using HttpClient 5.

    On enabling the HttpClient logs and found that the issue was due to stale connections.

    Adding the below helped to solve the issue, it detects and validates the connections that have become stale while kept inactive in the pool before reuse.

    PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
    
    connectionManager.setValidateAfterInactivity(timeinmilliseconds);
    

提交回复
热议问题