On Wed, 26 Mar 2025 10:49:06 GMT, Volkan Yazici <vyaz...@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:
> 
>   Improve JavaDoc

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

> 79:             = Comparator.comparing(HttpConnection::id);
> 80: 
> 81:     private static final AtomicLong LABEL_COUNTER = new AtomicLong();

In the API documentation on `HttpResponse.connectionLabel()` we talk about the 
connection label being unique within a `HttpClient` scope. i.e. two different 
`HttpClient` instances could have the same connectionLabel for a connection. I 
think that's the right scoping.

So given that, having a `static` field on a `HttpConnection` which keeps track 
of a connection label, may not be the right place to keep track of that state. 
In this proposed form, no two connections in two different HttpClient instances 
will ever have the same connectionLabel. I think this counter should probably 
be present on the `HttpClientImpl` as an instance field.

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

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

Reply via email to