Netflix/RxJava — pull request #1325 by benjchristensen (2014-06-05 05:04:53+00:00)
Title: PREVIEW-1 => Backpressure: Subscriber, Producer & ObserveOn

This is the first round of dev on backpressure and not even close to final. I am publishing as PR for collaboration. /cc @headinthebox @abersnaze @akarnokd

- 2 unit tests are failing as the sources don't yet support backpressure.
- There are stray printlns throughout code still.
- I have not yet attempted `merge` though I have a general strategy in mind. It is most likely my next thing to work on.
- I have not looked at performance impact at all.
- All names and object models are open to change.
- I've got `Atomic*` uses that need to become `*FieldUpdaters`
- Several TODOs showing where improvements need to be made, such as a proper ring-buffer implementation.

What to look at:

- `Subscriber` -> the `request` and `setProducer` methods
- `OnSubscribeFromIterable`
- `OperatorObserveOn`
- `RxSpscRingBuffer`

Work to do:

- the `subscribeOn` operator needs to decorate `setProducer` to compose the scheduling of starting up the `Producer` again
- `merge`
- backpressure operators such as `onBackpressureDrop`, `onBackpressureBuffer`, `onBackpressureUnsubscribe`, `onBackpressureSample/Throttle/etc`
- unit tests for various use cases
- performance and memory allocation testing
- prove with Netty channels
- determine if there are any use cases that will kill this ...
- for example, the `filter` operator must take `request` into account otherwise when it filters out events they won't propagate and then `request` may never get called again and the chain hangs
- there are likely other scenarios like `take` ... and some I'm concerned are nuanced