Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 7, 2017

Conversation

akarnokd
Copy link
Member

@akarnokd 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
Copy link

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

@@ -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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indent

@akarnokd akarnokd merged commit f38eb99 into ReactiveX:2.x Jan 7, 2017
@akarnokd akarnokd deleted the StrictMode branch January 7, 2017 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants