OnBackpressureXXX: support for common drain manager & fix for former concurrency bugs#1955
Conversation
|
This is complicated stuff, maybe an (internal) helper class should be created to help with future producer-backpressure-consumer management. |
reimplemented Buffer and Block strategies with it.
|
I hope the new |
|
Wow, this is some non-trivial stuff. Thanks for tackling this. It's going to take me a bit to grok it. |
|
Anyone else have the time and interest to also do a code review on the concurrency code in this? I'd appreciate more eyes than my own. |
There was a problem hiding this comment.
In this use case why would we ever be unsubscribing early? We can emit an onError, but I don't see the need to decouple the subscription.
There was a problem hiding this comment.
assertCapacity calls unsubscribe and would disrupt downstream.
|
I think this code is good to merge. I've asked a variety of clarifying questions that I want to review with you before I merge and release. |
There was a problem hiding this comment.
Wrong copyright, should be Netflix
|
Re-trigger travis. |
There was a problem hiding this comment.
Need to add if (capacity != null) capacity.incrementAndGet(); here.
|
Could you change CRLFs to LFs in BackpressureDrainManager? |
There was a problem hiding this comment.
isTerminated, terminate, terminate(Throwable) are not used. Could you explain why adding them?
There was a problem hiding this comment.
This is really a complex class. So I prefer to keep it as simple as possible.
This is quite a complex operator with lots of cases.
Properties:
3.a) If more was requested but nothing is available or nothing was requested and something is available: quit and let either the onNext or request do the subsequent drain.
3.b) If elements and termination was produced but not requested: quit and let the request do the drain
3.c) If termination was requested and no elements produced: loop , emit terminal event and quit.
In table form: