On Thu, 1 Oct 2020 10:31:58 GMT, Conor Cleary <ccle...@openjdk.org> wrote:
>> 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 Although Aleksey's proposal does not change the behavior, it raises a question (to be explored separately): can a stream be added to that map while `Http2Connection.shutdown` is in progress? If this is the case, then the method is racy. ------------- PR: https://git.openjdk.java.net/jdk/pull/431