RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview) [v2]

Viktor Klang vklang at openjdk.org
Thu Nov 9 21:18:24 UTC 2023


On Thu, 9 Nov 2023 14:41:10 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Viktor Klang has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Addressing review feedback
>>  - Make Gatherer.andThen take a wildcard for the rhs Gatherer state type
>
> src/java.base/share/classes/java/util/stream/Gatherers.java line 562:
> 
>> 560:     /**
>> 561:      * An operation which executes operations concurrently
>> 562:      * with a fixed window of max concurrency, using VirtualThreads.
> 
> Of the 5, this is the one that I'm not sure about so will be interesting to see if there is feedback from real world usage.
> 
> "VirtualThreads" isn't a class so maybe replace it with "virtual Threads", linked to Thread.html#virtual-threads.

Sounds good. Wilco

> src/java.base/share/classes/java/util/stream/Gatherers.java line 615:
> 
>> 613:                 assert wasAddedToWindow;
>> 614: 
>> 615:                 Thread.startVirtualThread(task);
> 
> At some point it might be worth seeing this should should use Executors.newVirtualThreadPerTaskExecutor(), that would at least simplify the cleanup as it would be executor.shutdownNow.  The serviceability benefit would be that an observer on a far hill taking a thread dump would have the virtual threads grouped for each mapConcurrent gatherer.

Yeah, that's a good point. I'll try that after this PR. 👍

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1388591370
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1388591204


More information about the core-libs-dev mailing list