Skip to content

Collapses 2.13 and 2.14 into one and changes the wording of the rule to ... #117

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

Merged
merged 1 commit into from
Oct 24, 2014

Conversation

viktorklang
Copy link
Contributor

...be positive.

Collapses 2.13 and 2.14 into one and changes the wording of the rule to be positive.
Rewords 1.8 so that it is simpler and positively worded.
Reformulates 1.9 in the same wording as 2.13.

Also includes minor reformatting.

As discussed in #106, with positive rule focus suggested by @DougLea

Review by @reactive-streams/contributors

| <a name="1.7">7</a> | Once a terminal state has been signaled (`onError`, `onComplete`) it is REQUIRED that no further signals occur. Situational scenario MAY apply [see 2.13]
| <a name="1.8">8</a> | `Subscription`'s which have been canceled SHOULD NOT receive subsequent `onError` or `onComplete` signals, but implementations will not be able to strictly guarantee this in all cases due to the intrinsic race condition between actions taken concurrently by `Publisher` and `Subscriber` |
| <a name="1.9">9</a> | `Publisher.subscribe` SHOULD NOT throw a non-fatal `Throwable`. The only legal way to signal failure (or reject a `Subscription`) is via the `onError` method. Non-fatal `Throwable` excludes any non-recoverable exception by the application (e.g. OutOfMemory) |
| <a name="1.7">7</a> | Once a terminal state has been signaled (`onError`, `onComplete`) it is REQUIRED that no further signals occur
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspect that this rule is now not needed and can be completely covered by 1.6

Copy link
Contributor

Choose a reason for hiding this comment

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

True, but 1.7 is very simple to understand I think, if it were me I'd keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about:

| 6 | If a Publisher signals either onError or onComplete on a Subscriber, that Subscriber’s Subscription MUST be considered canceled and it is REQUIRED that no further signals to it occur.

@viktorklang
Copy link
Contributor Author

A 1-week-later-ping to @reactive-streams/contributors

@viktorklang
Copy link
Contributor Author

SECOND PING @reactive-streams/contributors

@@ -117,8 +117,7 @@ public interface Subscriber<T> {
| <a name="2.10">10</a> | A `Subscriber` MUST be prepared to receive an `onError` signal with or without a preceding `Subscription.request(long n)` call |
| <a name="2.11">11</a> | A `Subscriber` MUST make sure that all calls on its `onXXX` methods happen-before [1] the processing of the respective signals. I.e. the Subscriber must take care of properly publishing the signal to its processing logic |
| <a name="2.12">12</a> | `Subscriber.onSubscribe` MUST NOT be called more than once (based on object equality) |
| <a name="2.13">13</a> | A failing `onComplete` invocation (e.g. throwing an exception) is a specification violation and MUST signal `onError` with `java.lang.IllegalStateException`. The cause message MUST include a reference to this rule and/or quote the full rule |
| <a name="2.14">14</a> | A failing `onError` invocation (e.g. throwing an exception) is a violation of the specification. In this case the `Publisher` MUST consider a possible `Subscription` for this `Subscriber` as canceled. The `Publisher` MUST raise this error condition in a fashion that is adequate for the runtime environment (e.g. by throwing an exception, notifying a supervisor, logging, etc.). |
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the spec214_failingOnErrorInvocation methods from the TCK as well as part of this PR then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Will do after I get some more feedback on the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ktoso I'm creating an Issue to update the TCK for the new 2.13

@viktorklang
Copy link
Contributor Author

23 days later, ping @reactive-streams/contributors

@benjchristensen
Copy link
Contributor

👍

@DougLea
Copy link
Contributor

DougLea commented Oct 15, 2014

This all looks OK to me, with one further suggestion. Consider transforming

"Subscriptionswhich have been canceled SHOULD NOT receive subsequentonErrororonCompletesignals, but implementations will not be able to strictly guarantee this in all cases due to the intrinsic race condition between actions taken concurrently byPublisherandSubscriber`"

to just something like:

Upon cancellation, a subscriber MUST eventually stop receiving onErrororonComplete` signals.

You could add something about promptness of shutting down signals being a quality of implmenetation issues, but why bother.

@jbrisbin
Copy link

After @DougLea suggestion: 👍

@benjchristensen
Copy link
Contributor

The plural nature of "onError or onComplete signals" doesn't seem quite right, especially ignoring onNext which is where plurality would happen.

If we're going to genericize this statement then I think it's more accurate to say:

Upon cancellation, a subscriber MUST eventually stop receiving signals.

I suggest this because onNext, onError or onComplete may all still be emitted after an unsubscribe.

@viktorklang
Copy link
Contributor Author

@benjchristensen I like "Upon cancellation, a subscriber MUST eventually stop receiving signals."
@DougLea & @reactive-streams/contributors, wdyt?

@jbrisbin
Copy link

👍

@viktorklang
Copy link
Contributor Author

When adding it I realized it harmonizes better with 1.3, 1.4 and 1.5 if it is worded like this:

| 8 | If a Subscription is cancelled its Subscriber MUST eventually stop being signaled |

I think the above is a keeper, but wdyt?

@benjchristensen
Copy link
Contributor

The rewording is good. I'm fine with either.

…to be positive.

Rewords 1.8 so that it is simpler and positively worded.
Reformulates 1.9 in the same wording as 2.13.
@viktorklang
Copy link
Contributor Author

@reactive-streams/contributors Please give a 👍 or object to these changes before the 24th of October GMT+0

@viktorklang
Copy link
Contributor Author

@reactive-streams/contributors Only 👍's and no objections. Merging

viktorklang added a commit that referenced this pull request Oct 24, 2014
Collapses 2.13 and 2.14 into one and changes the wording of the rule to ...
@viktorklang viktorklang merged commit 7ba25ff into master Oct 24, 2014
@viktorklang viktorklang deleted the wip-106-√ branch October 24, 2014 14:29
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.

5 participants