You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ followed by a possibly unbounded number of `onNext` signals (as requested by `Su
79
79
| <aname="term_non-obstructing">Non-obstructing</a> | Quality describing a method which is as quick to execute as possible—on the calling thread. This means, for example, avoids heavy computations and other things that would stall the caller´s thread of execution. |
80
80
| <aname="term_terminal_state">Terminal state</a> | For a Publisher: When `onComplete` or `onError` has been signalled. For a Subscriber: When an `onComplete` or `onError` has been received.|
81
81
| <aname="term_nop">NOP</a> | Execution that has no detectable effect to the calling thread, and can as such safely be called any number of times.|
82
-
82
+
| <aname="term_ext_sync">External synchronization</a> | Access coordination for thread safety purposes implemented outside of the constructs defined in this specification, using techniques such as, but not limited to, `atomics`, `monitors`, or `locks`. |
83
83
84
84
### SPECIFICATION
85
85
@@ -97,8 +97,8 @@ public interface Publisher<T> {
97
97
| [:bulb:](#1.1"1.1 explained") |*The intent of this rule is to make it clear that Publishers cannot signal more elements than Subscribers have requested. There’s an implicit, but important, consequence to this rule:Since demand can only be fulfilled after it has been received, there’s a happens-before relationship between requesting elements and receiving elements.*|
98
98
|<a name="1.2">2</a>|A `Publisher` MAY signal fewer `onNext` than requested and terminate the `Subscription` by calling `onComplete` or `onError`.|
99
99
| [:bulb:](#1.2"1.2 explained") |*The intent of this rule is to make it clear that a Publisher cannot guarantee that it will be able to produce the number of elements requested; it simply might not be able to produce them all; it may be in a failed state; it may be empty or otherwise already completed.*|
100
-
|<a name="1.3">3</a>| `onSubscribe`, `onNext`, `onError` and `onComplete` signaled to a `Subscriber` MUST be signaled in a `thread-safe` manner—and if performed by multiple threads—use `external synchronization`.|
101
-
| [:bulb:](#1.3"1.3 explained") |*The intent of this rule is to make it clear that `external synchronization` must be employed if the Publisher intends to send signals from multiple/different threads.*|
100
+
|<a name="1.3">3</a>| `onSubscribe`, `onNext`, `onError` and `onComplete` signaled to a `Subscriber` MUST be signaled in a `thread-safe` manner—and if performed by multiple threads—use [external synchronization](#term_ext_sync).|
101
+
| [:bulb:](#1.3"1.3 explained") |*The intent of this rule is to make it clear that [external synchronization](#term_ext_sync) must be employed if the Publisher intends to send signals from multiple/different threads.*|
102
102
|<a name="1.4">4</a>|If a `Publisher` fails it MUST signal an `onError`.|
103
103
| [:bulb:](#1.4"1.4 explained") |*The intent of this rule is to make it clear that a Publisher is responsible for notifying its Subscribersif it detects that it cannot proceed—Subscribers must be given a chance to clean up resources or otherwise deal with the Publisher´s failures.*|
104
104
|<a name="1.5">5</a>|If a `Publisher` terminates successfully (finite stream) it MUST signal an `onComplete`.|
@@ -141,8 +141,8 @@ public interface Subscriber<T> {
141
141
| [:bulb:](#2.5"2.5 explained") |*The intent of this rule is to prevent that two, or more, separate Publishers from thinking that they can interact with the same Subscriber. Enforcingthis rule means that resource leaks are prevented since extra Subscriptions will be cancelled.*|
142
142
|<a name="2.6">6</a>|A `Subscriber` MUST call `Subscription.cancel()` if the `Subscription` is no longer needed. |
143
143
| [:bulb:](#2.6"2.6 explained") |*The intent of this rule is to establish that Subscribers cannot just throwSubscriptions away when they are no longer needed, they have to call `cancel` so that resources held by that Subscription can be safely, and timely, reclaimed. An example of this would be a Subscriber which is only interested in a specific element, which would then cancel its Subscription to signal its completion to the Publisher.*|
144
-
|<a name="2.7">7</a>|A `Subscriber` MUST ensure that all calls on its `Subscription` take place from the same thread or provide for respective external synchronization. |
145
-
| [:bulb:](#2.7"2.7 explained") |*The intent of this rule is to establish that external synchronization must be added if a Subscriber will be using a Subscription concurrently by two or more threads.*|
144
+
|<a name="2.7">7</a>|A `Subscriber` MUST ensure that all calls on its `Subscription` take place from the same thread or provide for respective [external synchronization](#term_ext_sync).|
145
+
| [:bulb:](#2.7"2.7 explained") |*The intent of this rule is to establish that [external synchronization](#term_ext_sync) must be added if a Subscriber will be using a Subscription concurrently by two or more threads.*|
146
146
|<a name="2.8">8</a>|A `Subscriber` MUST be prepared to receive one or more `onNext` signals after having called `Subscription.cancel()` if there are still requested elements pending [see [3.12](#3.12)]. `Subscription.cancel()` does not guarantee to perform the underlying cleaning operations immediately. |
147
147
| [:bulb:](#2.8"2.8 explained") |*The intent of this rule is to highlight that there may be a delay between calling `cancel` the Publisher seeing that.*|
148
148
|<a name="2.9">9</a>|A `Subscriber` MUST be prepared to receive an `onComplete` signal with or without a preceding `Subscription.request(long n)` call. |
0 commit comments