Re: java.util.concurrent.Flow with opposite direction of item flow
Alex Otenko via Concurrency-interest <[email protected]>
| Newsgroups | gmane.comp.java.jsr.166-concurrency |
|---|---|
| Message-ID | <CANkgWKh979eRCQHLdmtWtUYbXrWbVzXgpxtOUbWko8+Lie6UWg@mail.gmail.com> |
No, that's far from obvious. If you follow the half-queue example, you will see that the communication is initiated by the consumer initialising the buffer with Unit objects. (Ok, array full of nulls in Java world. Only without the half-queue example it is harder to see that it is the consumer that is doing it) Alex On Sat, 21 Dec 2019, 07:34 Alexei Kaigorodov via Concurrency-interest, < [email protected]> wrote: > The justification is obvious: in synchronous case, the communication is > initiated by Producer: it calls BlockingQueue#put(item), while the queue > does not call anything like Producer#get(). We want to convert synchronous > communication to asynchronous with minimal efforts, so we still need active > Producer and passive Queue. And since in the pair Publisher/Subscriber > Publisher is passive and Subscriber is active, AsyncQueue must act like > Publisher and Producer must act like Subscriber. > > > > -- > Sent from: http://jsr166-concurrency.10961.n7.nabble.com/ > _______________________________________________ > Concurrency-interest mailing list > [email protected] > http://cs.oswego.edu/mailman/listinfo/concurrency-interest > _______________________________________________ Concurrency-interest mailing list [email protected] http://cs.oswego.edu/mailman/listinfo/concurrency-interest