RFR: 8350279: HttpClient: Add a new HttpResponse method to identify connections [v5]

Jaikiran Pai jpai at openjdk.org
Wed Apr 2 11:10:52 UTC 2025


On Tue, 1 Apr 2025 19:11:02 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Adds `HttpResponse::connectionLabel` method that provides an identifier for the connection.
>> 
>> **Implementation note:** The feature is facilitated by `HttpConnection::label`, which should not be confused with `HttpConnection::id`. This distinction is explained in the JavaDoc of both properties.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Apply review suggestions

src/java.net.http/share/classes/jdk/internal/net/http/HttpConnection.java line 114:

> 112: 
> 113:     private static String nextLabel() {
> 114:         return "" + LABEL_COUNTER.getAndIncrement();

The first label that this will generate will be `0`. It might be OK, but I think it would be better if we start it as `1`. So maybe consider using `LABEL_COUNTER.incrementAndGet()` instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24154#discussion_r2024605799


More information about the net-dev mailing list