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

Volkan Yazici vyazici at openjdk.org
Tue Apr 1 19:16:19 UTC 2025


On Thu, 27 Mar 2025 15:24:15 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>>> The only use of HttpConnection.id is for ordering - so that connections can be placed in a ConcurrentSkipListSet.
>> 
>> I wasn't aware of that. Now that you mentioned it, I looked up the code which uses the Set to store these connections. And from what I can see, the order is only used during the closing of a HttpClient, to close these opened connections in that specific order. Did I miss any other usages of the order?
>> 
>> In any case, now that you corrected me about the usage of the `id` order, I agree that having the comment on the `id` field is fine and only remove it from the paragraph here.
>
> When we close a connection, we take it out of the set. So it's not about ordering the connection but about quickly finding the connection in that set.

It was already a puzzler for me to figure out `id` cannot be used for `label`, and `label` cannot be used for `id` either. Both are due to the fact that `label` can be shared across instances, whereas `id` cannot. In short, I've found it very helpful to thoroughly document their these fields' properties and what they serve for. Unless you have a strong objection, I'd like to keep the current form of documentation.

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

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


More information about the net-dev mailing list