RFR: 8361249: PlainHttpConnection connection logic can be simplified
Volkan Yazici
vyazici at openjdk.org
Thu Jul 3 10:56:46 UTC 2025
On Wed, 2 Jul 2025 08:37:34 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> The PlainHttpConnection::connectAsync method implements a retry logic that will call connect() again if connect() throws the first time. This will not work, as the channel is closed when connect() throws. That logic should be removed. Reconnection should only be attempted at a higher level (MultiExchange).
src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java line 1:
> 1: /*
Shouldn't we remove the following too?
1. The `unsuccessfulAttempts` field
2. `jdk.internal.net.http.common.TimeSource` import
src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java line 232:
> 230: }
> 231: return cf.thenApply((state)->{
> 232: if (debug.on()) debug.log("%s: %s", label(), state);
AFAICT, this is the only place where a `ConnectState` is _read_. Alternatively, we can remove the `ConnectState` enum and add `debug.log()` statements where `ConnectState` were assigned.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26087#discussion_r2182475581
PR Review Comment: https://git.openjdk.org/jdk/pull/26087#discussion_r2182483092
More information about the net-dev
mailing list