简体   繁体   English

Apache Httpclient连接尚未发布

[英]Apache Httpclient Connection not Released

I am using spring rest template to send REST request with apache http client 4.2.1 intergrated. 我正在使用Spring rest模板发送REST请求与apache http client 4.2.1集成。

As we need send request to multiple server, added PoolingClientConnectionManager to manager the connections. 由于我们需要向多个服务器发送请求,因此添加了PoolingClientConnectionManager来管理连接。

Set the max per route to 5 connectionManager.setDefaultMaxPerRoute(5) 将每条路由的最大值设置为5 connectionManager.setDefaultMaxPerRoute(5)

While after the system running for few days, we found that the connection reached the maxmium per route settings. 在系统运行几天后,我们发现连接达到每路径设置的最大值。

Printed log as below total kept alive: 0; 下面的印刷日志保持活力:0; route allocated: 5 of 5; 分配路线:5/5; total allocated: 5 of 100 总分配:100分中的5分

Seems the connection is not released by some reason. 似乎由于某种原因没有释放连接。 But when i debug, i found every time after request is finished, the connection will be released even there's exception happens. 但是当我调试时,我发现每次请求完成后,即使发生异常,连接也会被释放。

Is there any other potential root cause of this connection cannot be released? 是否有任何其他潜在的根本原因无法释放此连接?

这是因为在某些情况下,服务器持有请求,我们需要为http客户端添加超时

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM