On Tue, 6 Sep 2022 13:56:15 GMT, Conor Cleary <[email protected]> wrote:
> **Issue**
> When using HTTP/2 with the HttpClient, it can often be necessary to close an
> idle Http2 Connection before a server sends a GOAWAY frame. For example, a
> server or cloud based tool could close a TCP connection silently when it is
> idle for too long resulting in ConnectionResetException being thrown by the
> HttpClient.
>
> **Proposed Solution**
> A new system property, `jdk.httpclient.idleConnectionTimeout`, was added and
> is used to specify in Milliseconds how long an idle connection (idle
> connections are those which have no currently active streams) for the
> HttpClient before the connection is closed.
src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java line
200:
> 198: debug.log("HTTP connection idle for too long");
> 199: }
> 200: HttpTimeoutException hte = new HttpTimeoutException("HTTP
> connection idle, no active streams. Shutting down.");
Hello Conor,
The javadoc of `HttpTimeoutException` states "Thrown when a response is not
received within a specified time period.", which isn't what we are using it
for, here. Do you think we should instead just use a `Exception` (or some
internal exception type) since this (as far as I can see) won't get propagated
to the application?
-------------
PR: https://git.openjdk.org/jdk/pull/10183