RFR: 8278067: Make HttpURLConnection default keep alive timeout configurable

Daniel Fuchs dfuchs at openjdk.java.net
Fri Feb 4 14:15:10 UTC 2022


On Fri, 4 Feb 2022 13:11:02 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

> Hi,
> 
> Could I get the following patch reviewed please? (A CSR is also required which I will submit when the docs are agreed)
> 
> It adds a pair of new system properties to make the keep alive timer in java.net.HttpURLConnection configurable.
> The proposed property names are:
> 
> "http.keepAlive.time.server" and "http.keepAlive.time.proxy"
> 
> Thanks,
> Michael

src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java line 159:

> 157:                 int keepAliveTimeout = http.getKeepAliveTimeout();
> 158:                 if (keepAliveTimeout == 0) {
> 159:                     keepAliveTimeout = getUserKeepAlive(http.getUsingProxy());

This could be 0 if -Dhttp.keepAlive.time.xxx=0 was specified which would result in an assert below.
Also I am not sure I understand the logic of having same 5s timeout for server & proxy if nothing was specified anywhere, but having a different value for proxy & server if the server specified keep-alive without providing a value.
Where does that come from?

-------------

PR: https://git.openjdk.java.net/jdk/pull/7349


More information about the net-dev mailing list