[concurrency-interest] question about j.u.c.Flow.Subscription

Dávid Karnok akarnokd at gmail.com
Mon Sep 14 12:39:15 EDT 2015


Hello,

the original reactive-streams spec calls for limited recursion between
onNext() and request() which is what is the expectation in j.u.c.Flow as I
see.

There are several "schools" of implementing reentrant-safe and thread-safe
Subscriptions. I personally like to use atomic increments and separate
state flags whereas j.u.c. seems to use compact state values with CAS loops.

In fact, I can point you to a full-featuted fluent implementation of the
reactive-streams API that had to deal with this exact situation in many
forms and shapes.

2015-09-14 18:03 GMT+02:00 Michael McMahon <michael.x.mcmahon at oracle.com>:

> Hi,
>
> 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?
>
> Thanks,
> Michael.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>



-- 
Best regards,
David Karnok
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20150914/eb93a7dc/attachment.html>


More information about the Concurrency-interest mailing list