[concurrency-interest] question about j.u.c.Flow.Subscription
viktor.klang at gmail.com
Mon Sep 14 13:09:52 EDT 2015
It should be covered in the specification under the rule: 2:3
"Subscription.request MUST place an upper bound on possible synchronous
recursion between Publisherand Subscriber[1
 : An example for undesirable synchronous, open recursion would be
Subscriber.onNext -> Subscription.request ->Subscriber.onNext -> …, as it
very quickly would result in blowing the calling Thread´s stack.
The recommended upper bound would be 1, but it is of course up to the
implementation how it wants to do the "trampolining". This rule is also
tested in the TCK.
Does that cover your question?
(link to the 1.0.0 spec:
On Mon, Sep 14, 2015 at 6:03 PM, Michael McMahon <
michael.x.mcmahon at oracle.com> wrote:
> I have a question about Flow subscribers and publishers.
> Is it allowable for a j.u.c.Flow.Publisher to directly invoke a
> subscriber's methods
> through its subscription object?
> For example, can the implementation of Subscription.request(n)
> call Subscriber.onNext() up to n times, before request() returns?
> Considering that Subscriber.onNext() will often call Subscription.request()
> you could easily get a recursive loop, but the question is whether
> the spec allows it?
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest