Java - exact meaning http.maxConnections

时光总嘲笑我的痴心妄想 提交于 2020-05-30 19:28:14

问题


Recently I came across 2 slightly different definitions of the java property http.maxConnections provided by Oracle.

here it's defined as

If HTTP keepalive is enabled this value determines the maximum number of idle connections that will be simultaneously kept alive, per destination.

whereas here it's defined as

Indicates the maximum number of connections per destination to be kept alive at any given time

What confuses me is the word idle mentioned in the first definition above. Considering the first definition my understanding is that this property limits only the number of connections which are there in the connection pool but that are not used. This means that regardless of this config, I could have un "unlimited" number of active connections towards the same endpoint running at the same time.I don't have the same understanding if I consider the second definition above, where Oracle removed te keyword idle. In this last it seems this property is meant to limit the total number of connections towards an endpoint, so if I configure http.maxConnections=10 I can have at maximum 10 simultaneous calls towards the same endpoint.

Can someone clear my doubts ?

Thanks!

(ps: for the sake of completeness i'm interested in Java8 behavior)


回答1:


Code inspection shows that the property is only used to limit the size of the keep-alive cache - so unless I'm mistaken that's really the maximum number of idle connections.



来源:https://stackoverflow.com/questions/53720957/java-exact-meaning-http-maxconnections

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!