2.x: add strict() operator for strong RS conformance #4966

Merged
merged 2 commits into from Jan 7, 2017

Projects

None yet

3 participants

@akarnokd
Member
akarnokd commented Jan 6, 2017

This PR adds a new instance operator strict():

Ensures that the event flow between the upstream and downstream follow the Reactive-Streams 1.0 specification by honoring the 3 additional rules (which are omitted in standard operators due to performance reasons).

  • §1.3: onNext should not be called concurrently until onSubscribe returns
  • §2.3: onError or onComplete must not call cancel
  • §3.9: negative requests should emit an onError(IllegalArgumentException)

In addition, if rule §2.12 (onSubscribe must be called at most once) is violated, the sequence is cancelled an onError(IllegalStateException) is emitted. Note that the Reactive-Streams specification doesn't have any sanction for violating §2.12.

The strict() operator also replaces the test-only operators that were supporting the Reactive-Streams TCKs already.

@akarnokd akarnokd added this to the 2.1 milestone Jan 6, 2017
@codecov-io

Current coverage is 95.61% (diff: 100%)

Merging #4966 into 2.x will decrease coverage by 0.03%

@@                2.x      #4966   diff @@
==========================================
  Files           587        588     +1   
  Lines         37671      37706    +35   
  Methods           0          0          
  Messages          0          0          
  Branches       5676       5679     +3   
==========================================
+ Hits          36031      36053    +22   
- Misses          696        698     +2   
- Partials        944        955    +11   

Powered by Codecov. Last update b917754...c4d9ff5

@DavidMGross DavidMGross referenced this pull request in ReactiveX/reactivex.github.io Jan 6, 2017
Open

Document new strict() operator #337

@@ -29,9 +29,7 @@ public ObserveOnTckTest() {
@Override
public Publisher<Integer> createPublisher(long elements) {
return FlowableTck.wrap(
- FlowableAwaitOnSubscribeTck.wrap(
Flowable.range(0, (int)elements).observeOn(Schedulers.single())
@JakeWharton
JakeWharton Jan 7, 2017 Member

nit: indent

@akarnokd akarnokd merged commit f38eb99 into ReactiveX:2.x Jan 7, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@akarnokd akarnokd deleted the akarnokd:StrictMode branch Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment