39 |
|
* private boolean subscribed; // true after first subscribe |
40 |
|
* public synchronized void subscribe(Subscriber<? super Boolean> subscriber) { |
41 |
|
* if (subscribed) |
42 |
< |
* subscriber.onError(new IllegalStateException()); // only one allowed |
42 |
> |
* subscriber.onError(new IllegalStateException()); // only one allowed |
43 |
|
* else { |
44 |
|
* subscribed = true; |
45 |
|
* subscriber.onSubscribe(new OneShotSubscription(subscriber, executor)); |
242 |
|
/** |
243 |
|
* Adds the given number {@code n} of items to the current |
244 |
|
* unfulfilled demand for this subscription. If {@code n} is |
245 |
< |
* negative, the Subscriber will receive an {@code onError} |
246 |
< |
* signal with an {@link IllegalArgumentException} argument. |
247 |
< |
* Otherwise, the Subscriber will receive up to {@code n} |
248 |
< |
* additional {@code onNext} invocations (or fewer if |
249 |
< |
* terminated). |
245 |
> |
* less than or equal to zero, the Subscriber will receive an |
246 |
> |
* {@code onError} signal with an {@link |
247 |
> |
* IllegalArgumentException} argument. Otherwise, the |
248 |
> |
* Subscriber will receive up to {@code n} additional {@code |
249 |
> |
* onNext} invocations (or fewer if terminated). |
250 |
|
* |
251 |
|
* @param n the increment of demand; a value of {@code |
252 |
|
* Long.MAX_VALUE} may be considered as effectively unbounded |