16
16
import java .util .Objects ;
17
17
import java .util .concurrent .TimeUnit ;
18
18
19
- import org .reactivestreams .Subscriber ;
19
+ import org .reactivestreams .* ;
20
20
21
21
import io .reactivex .rxjava3 .annotations .*;
22
22
import io .reactivex .rxjava3 .core .*;
37
37
* <img width="640" height="510" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.v3.png" alt="">
38
38
* <p>
39
39
* When the upstream terminates, the {@code ConnectableFlowable} remains in this terminated state and,
40
- * depending on the actual underlying implementation, relays cached events to late {@link Subscriber}s.
40
+ * depending on the actual underlying implementation, relays cached events to late {@code Subscriber}s.
41
41
* In order to reuse and restart this {@code ConnectableFlowable}, the {@link #reset()} method has to be called.
42
- * When called, this {@code ConnectableFlowable} will appear as fresh, unconnected source to new {@link Subscriber}s.
42
+ * When called, this {@code ConnectableFlowable} will appear as fresh, unconnected source to new {@code Subscriber}s.
43
43
* Disposing the connection will reset the {@code ConnectableFlowable} to its fresh state and there is no need to call
44
44
* {@code reset()} in this case.
45
45
* <p>
48
48
* there is no unwanted signal loss due to early {@code connect()} or {@code reset()} calls while {@code Subscriber}s are
49
49
* still being subscribed to to this {@code ConnectableFlowable} to receive signals from the get go.
50
50
* <p>
51
- * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators">RxJava Wiki:
52
- * Connectable Observable Operators</a>
51
+ * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators">RxJava Wiki: Connectable Observable Operators</a>
53
52
* @param <T>
54
53
* the type of items emitted by the {@code ConnectableFlowable}
55
54
* @since 2.0.0
@@ -74,7 +73,7 @@ public abstract class ConnectableFlowable<T> extends Flowable<T> {
74
73
public abstract void connect (@ NonNull Consumer <? super Disposable > connection );
75
74
76
75
/**
77
- * Resets this ConnectableFlowable into its fresh state if it has terminated.
76
+ * Resets this {@code ConnectableFlowable} into its fresh state if it has terminated.
78
77
* <p>
79
78
* Calling this method on a fresh or active {@code ConnectableFlowable} has no effect.
80
79
* <dl>
@@ -108,7 +107,7 @@ public final Disposable connect() {
108
107
}
109
108
110
109
/**
111
- * Returns a {@code Flowable} that stays connected to this {@code ConnectableFlowable} as long as there
110
+ * Returns a {@link Flowable} that stays connected to this {@code ConnectableFlowable} as long as there
112
111
* is at least one subscription to this {@code ConnectableFlowable}.
113
112
* <dl>
114
113
* <dt><b>Backpressure:</b></dt>
@@ -117,7 +116,7 @@ public final Disposable connect() {
117
116
* <dt><b>Scheduler:</b></dt>
118
117
* <dd>This {@code refCount} overload does not operate on any particular {@link Scheduler}.</dd>
119
118
* </dl>
120
- * @return a {@link Flowable}
119
+ * @return the new {@code Flowable} instance
121
120
* @see <a href="http://reactivex.io/documentation/operators/refcount.html">ReactiveX documentation: RefCount</a>
122
121
* @see #refCount(int)
123
122
* @see #refCount(long, TimeUnit)
@@ -143,7 +142,8 @@ public Flowable<T> refCount() {
143
142
* </dl>
144
143
* <p>History: 2.1.14 - experimental
145
144
* @param subscriberCount the number of subscribers required to connect to the upstream
146
- * @return the new Flowable instance
145
+ * @return the new {@link Flowable} instance
146
+ * @throws IllegalArgumentException if {@code subscriberCount} is non-positive
147
147
* @since 2.2
148
148
*/
149
149
@ CheckReturnValue
@@ -168,7 +168,7 @@ public final Flowable<T> refCount(int subscriberCount) {
168
168
* <p>History: 2.1.14 - experimental
169
169
* @param timeout the time to wait before disconnecting after all subscribers unsubscribed
170
170
* @param unit the time unit of the timeout
171
- * @return the new Flowable instance
171
+ * @return the new {@link Flowable} instance
172
172
* @throws NullPointerException if {@code unit} is {@code null}
173
173
* @see #refCount(long, TimeUnit, Scheduler)
174
174
* @since 2.2
@@ -196,7 +196,7 @@ public final Flowable<T> refCount(long timeout, @NonNull TimeUnit unit) {
196
196
* @param timeout the time to wait before disconnecting after all subscribers unsubscribed
197
197
* @param unit the time unit of the timeout
198
198
* @param scheduler the target scheduler to wait on before disconnecting
199
- * @return the new Flowable instance
199
+ * @return the new {@link Flowable} instance
200
200
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
201
201
* @since 2.2
202
202
*/
@@ -223,8 +223,9 @@ public final Flowable<T> refCount(long timeout, @NonNull TimeUnit unit, @NonNull
223
223
* @param subscriberCount the number of subscribers required to connect to the upstream
224
224
* @param timeout the time to wait before disconnecting after all subscribers unsubscribed
225
225
* @param unit the time unit of the timeout
226
- * @return the new Flowable instance
226
+ * @return the new {@link Flowable} instance
227
227
* @throws NullPointerException if {@code unit} is {@code null}
228
+ * @throws IllegalArgumentException if {@code subscriberCount} is non-positive
228
229
* @see #refCount(int, long, TimeUnit, Scheduler)
229
230
* @since 2.2
230
231
*/
@@ -252,7 +253,7 @@ public final Flowable<T> refCount(int subscriberCount, long timeout, @NonNull Ti
252
253
* @param timeout the time to wait before disconnecting after all subscribers unsubscribed
253
254
* @param unit the time unit of the timeout
254
255
* @param scheduler the target scheduler to wait on before disconnecting
255
- * @return the new Flowable instance
256
+ * @return the new {@link Flowable} instance
256
257
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
257
258
* @throws IllegalArgumentException if {@code subscriberCount} is non-positive
258
259
* @since 2.2
@@ -269,20 +270,20 @@ public final Flowable<T> refCount(int subscriberCount, long timeout, @NonNull Ti
269
270
}
270
271
271
272
/**
272
- * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
273
- * when the first Subscriber subscribes.
273
+ * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable}
274
+ * when the first {@link Subscriber} subscribes.
274
275
* <p>
275
276
* <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
276
277
* <p>
277
278
* The connection happens after the first subscription and happens at most once
278
- * during the lifetime of the returned Flowable. If this ConnectableFlowable
279
- * terminates, the connection is never renewed, no matter how Subscribers come
279
+ * during the lifetime of the returned {@code Flowable} . If this {@code ConnectableFlowable}
280
+ * terminates, the connection is never renewed, no matter how {@code Subscriber}s come
280
281
* and go. Use {@link #refCount()} to renew a connection or dispose an active
281
- * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
282
+ * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s.
282
283
* <p>
283
284
* This overload does not allow disconnecting the connection established via
284
285
* {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload
285
- * to gain access to the {@code Disposable} representing the only connection.
286
+ * to gain access to the {@link Disposable} representing the only connection.
286
287
* <dl>
287
288
* <dt><b>Backpressure:</b></dt>
288
289
* <dd>The operator itself doesn't interfere with backpressure which is determined by
@@ -291,8 +292,8 @@ public final Flowable<T> refCount(int subscriberCount, long timeout, @NonNull Ti
291
292
* <dd>{@code autoConnect} does not operate by default on a particular {@link Scheduler}.</dd>
292
293
* </dl>
293
294
*
294
- * @return a Flowable that automatically connects to this ConnectableFlowable
295
- * when the first Subscriber subscribes
295
+ * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable}
296
+ * when the first {@code Subscriber} subscribes
296
297
* @see #refCount()
297
298
* @see #autoConnect(int, Consumer)
298
299
*/
@@ -304,20 +305,20 @@ public Flowable<T> autoConnect() {
304
305
return autoConnect (1 );
305
306
}
306
307
/**
307
- * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
308
- * when the specified number of Subscribers subscribe to it.
308
+ * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable}
309
+ * when the specified number of {@link Subscriber}s subscribe to it.
309
310
* <p>
310
311
* <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
311
312
* <p>
312
313
* The connection happens after the given number of subscriptions and happens at most once
313
- * during the lifetime of the returned Flowable. If this ConnectableFlowable
314
- * terminates, the connection is never renewed, no matter how Subscribers come
314
+ * during the lifetime of the returned {@code Flowable} . If this {@code ConnectableFlowable}
315
+ * terminates, the connection is never renewed, no matter how {@code Subscriber}s come
315
316
* and go. Use {@link #refCount()} to renew a connection or dispose an active
316
- * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
317
+ * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s.
317
318
* <p>
318
319
* This overload does not allow disconnecting the connection established via
319
320
* {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload
320
- * to gain access to the {@code Disposable} representing the only connection.
321
+ * to gain access to the {@link Disposable} representing the only connection.
321
322
* <dl>
322
323
* <dt><b>Backpressure:</b></dt>
323
324
* <dd>The operator itself doesn't interfere with backpressure which is determined by
@@ -327,10 +328,10 @@ public Flowable<T> autoConnect() {
327
328
* </dl>
328
329
*
329
330
* @param numberOfSubscribers the number of subscribers to await before calling connect
330
- * on the ConnectableFlowable. A non-positive value indicates
331
+ * on the {@code ConnectableFlowable} . A non-positive value indicates
331
332
* an immediate connection.
332
- * @return a Flowable that automatically connects to this ConnectableFlowable
333
- * when the specified number of Subscribers subscribe to it
333
+ * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable}
334
+ * when the specified number of {@code Subscriber}s subscribe to it
334
335
*/
335
336
@ NonNull
336
337
@ CheckReturnValue
@@ -341,17 +342,17 @@ public Flowable<T> autoConnect(int numberOfSubscribers) {
341
342
}
342
343
343
344
/**
344
- * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
345
- * when the specified number of Subscribers subscribe to it and calls the
346
- * specified callback with the Subscription associated with the established connection.
345
+ * Returns a {@link Flowable} that automatically connects (at most once) to this {@code ConnectableFlowable}
346
+ * when the specified number of {@link Subscriber}s subscribe to it and calls the
347
+ * specified callback with the {@link Disposable} associated with the established connection.
347
348
* <p>
348
349
* <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
349
350
* <p>
350
351
* The connection happens after the given number of subscriptions and happens at most once
351
- * during the lifetime of the returned Flowable. If this ConnectableFlowable
352
- * terminates, the connection is never renewed, no matter how Subscribers come
352
+ * during the lifetime of the returned {@code Flowable} . If this {@code ConnectableFlowable}
353
+ * terminates, the connection is never renewed, no matter how {@code Subscriber}s come
353
354
* and go. Use {@link #refCount()} to renew a connection or dispose an active
354
- * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
355
+ * connection when all {@code Subscriber}s have cancelled their {@link Subscription}s.
355
356
* <dl>
356
357
* <dt><b>Backpressure:</b></dt>
357
358
* <dd>The operator itself doesn't interfere with backpressure which is determined by
@@ -361,13 +362,13 @@ public Flowable<T> autoConnect(int numberOfSubscribers) {
361
362
* </dl>
362
363
*
363
364
* @param numberOfSubscribers the number of subscribers to await before calling connect
364
- * on the ConnectableFlowable. A non-positive value indicates
365
+ * on the {@code ConnectableFlowable} . A non-positive value indicates
365
366
* an immediate connection.
366
- * @param connection the callback Consumer that will receive the Subscription representing the
367
+ * @param connection the callback {@link Consumer} that will receive the {@code Disposable} representing the
367
368
* established connection
368
- * @return a Flowable that automatically connects to this ConnectableFlowable
369
- * when the specified number of Subscribers subscribe to it and calls the
370
- * specified callback with the Subscription associated with the established connection
369
+ * @return a new {@code Flowable} instance that automatically connects to this {@code ConnectableFlowable}
370
+ * when the specified number of {@code Subscriber}s subscribe to it and calls the
371
+ * specified callback with the {@code Disposable} associated with the established connection
371
372
* @throws NullPointerException if {@code connection} is {@code null}
372
373
*/
373
374
@ NonNull
0 commit comments