[concurrency-interest] jdk9 Candidate classes Flow and SubmissionPublisher

Here's the only set of candidates for new jdk9 j.u.c classes: As discussed a few months ago, there is no single best fluent async/parallel API. CompletableFuture/CompletionStage best supports continuation-style programming on futures, and java.util.stream best supports (multi-stage, possibly-parallel) "pull" style operations on the elements of collections. Until now, one missing category was "push" style operations on items as they become available from an active source. We are not alone in wanting a standard way to support this. Over the past year, the "reactive-streams" (http://www.reactive-streams.org/) effort has been defining a minimal set of interfaces expressing commonalities and allowing interoperablility across frameworks (including Rx and Akka Play), that is nearing release. These interfaces include provisions for a simple form of async flow control allowing developers to address resource control issues that can otherwise cause problems in push-based systems. Supporting this mini-framework helps avoid unpleasant surprises possible when trying to use pull-style APIs for "hot" reactive sources (but conversely is not as good a choice as java.util.Stream for "cold" sources like collections). The four intertwined interfaces (Publisher, Subscriber, Subscription, Processor) are defined within the same class "Flow", that also includes the first of some planned support methods to establish and use Flow components, including tie-ins to java.util.streams and CompletableFutures. See http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/Flow.html (Logistically, the only alternative to class Flow would have been to introduce a subpackage, which unnecessarily complicates usage. And "import static java.util.concurrent.Flow;" is about as convenient as "import java.util.concurrent.flow.*;" would be.) Also, the new stand-alone class SubmissionPublisher can serve as a bridge from various kinds of item producers to Flow components, and is useful in its own right. It is a form of ordered multicaster that people have complained that we don't support in j.u.c, but now do. See http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/SubmissionPublisher.html Disclaimers: These are only candidates for inclusion. The are in preliminary form and will change. But comments and suggestions would be welcome. As with the other candidate additions, if you are brave, you can try out snapshots on jdk8+ by getting http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166.jar and running java -Xbootclasspath/p:jsr166.jar -Doug