RFR: 8253179: Replace LinkedList Impl in net.http.Http2Connection
Conor Cleary
ccleary at openjdk.java.net
Thu Oct 1 10:34:27 UTC 2020
On Thu, 1 Oct 2020 09:43:46 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java line 703:
>>
>>> 701: if (initialCause == null) this.cause = t;
>>> 702: client2.deleteConnection(this);
>>> 703: List<Stream<?>> c = new ArrayList<>(streams.values());
>>
>> Why can't we dispense with this copy completely, and instead just iterate `streams.values()`?
>
> Good point Aleksey. I guess that the original intent was to avoid `ConcurrentModificationException`. However I see that
> `streams` is a `ConcurrentHashMap` now. So maybe we could dispense of the copy:
> ` private final Map<Integer,Stream<?>> streams = new ConcurrentHashMap<>();`
>
> Could be worth changing the type from `Map<Integer,Stream<?>>` to `ConcurrentMap<Integer,Stream<?>>` in the declaration
> above if we decide to get rid of the copy though.
Taking a look at this presently
-------------
PR: https://git.openjdk.java.net/jdk/pull/431
More information about the net-dev
mailing list