1616import java .util .Objects ;
1717import java .util .concurrent .TimeUnit ;
1818
19- import org .reactivestreams .Subscriber ;
19+ import org .reactivestreams .* ;
2020
2121import io .reactivex .rxjava3 .annotations .*;
2222import io .reactivex .rxjava3 .core .*;
3737 * <img width="640" height="510" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.v3.png" alt="">
3838 * <p>
3939 * 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.
4141 * 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.
4343 * Disposing the connection will reset the {@code ConnectableFlowable} to its fresh state and there is no need to call
4444 * {@code reset()} in this case.
4545 * <p>
4848 * there is no unwanted signal loss due to early {@code connect()} or {@code reset()} calls while {@code Subscriber}s are
4949 * still being subscribed to to this {@code ConnectableFlowable} to receive signals from the get go.
5050 * <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>
5352 * @param <T>
5453 * the type of items emitted by the {@code ConnectableFlowable}
5554 * @since 2.0.0
@@ -74,7 +73,7 @@ public abstract class ConnectableFlowable<T> extends Flowable<T> {
7473 public abstract void connect (@ NonNull Consumer <? super Disposable > connection );
7574
7675 /**
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.
7877 * <p>
7978 * Calling this method on a fresh or active {@code ConnectableFlowable} has no effect.
8079 * <dl>
@@ -108,7 +107,7 @@ public final Disposable connect() {
108107 }
109108
110109 /**
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
112111 * is at least one subscription to this {@code ConnectableFlowable}.
113112 * <dl>
114113 * <dt><b>Backpressure:</b></dt>
@@ -117,7 +116,7 @@ public final Disposable connect() {
117116 * <dt><b>Scheduler:</b></dt>
118117 * <dd>This {@code refCount} overload does not operate on any particular {@link Scheduler}.</dd>
119118 * </dl>
120- * @return a {@link Flowable}
119+ * @return the new {@code Flowable} instance
121120 * @see <a href="http://reactivex.io/documentation/operators/refcount.html">ReactiveX documentation: RefCount</a>
122121 * @see #refCount(int)
123122 * @see #refCount(long, TimeUnit)
@@ -143,7 +142,8 @@ public Flowable<T> refCount() {
143142 * </dl>
144143 * <p>History: 2.1.14 - experimental
145144 * @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
147147 * @since 2.2
148148 */
149149 @ CheckReturnValue
@@ -168,7 +168,7 @@ public final Flowable<T> refCount(int subscriberCount) {
168168 * <p>History: 2.1.14 - experimental
169169 * @param timeout the time to wait before disconnecting after all subscribers unsubscribed
170170 * @param unit the time unit of the timeout
171- * @return the new Flowable instance
171+ * @return the new {@link Flowable} instance
172172 * @throws NullPointerException if {@code unit} is {@code null}
173173 * @see #refCount(long, TimeUnit, Scheduler)
174174 * @since 2.2
@@ -196,7 +196,7 @@ public final Flowable<T> refCount(long timeout, @NonNull TimeUnit unit) {
196196 * @param timeout the time to wait before disconnecting after all subscribers unsubscribed
197197 * @param unit the time unit of the timeout
198198 * @param scheduler the target scheduler to wait on before disconnecting
199- * @return the new Flowable instance
199+ * @return the new {@link Flowable} instance
200200 * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
201201 * @since 2.2
202202 */
@@ -223,8 +223,9 @@ public final Flowable<T> refCount(long timeout, @NonNull TimeUnit unit, @NonNull
223223 * @param subscriberCount the number of subscribers required to connect to the upstream
224224 * @param timeout the time to wait before disconnecting after all subscribers unsubscribed
225225 * @param unit the time unit of the timeout
226- * @return the new Flowable instance
226+ * @return the new {@link Flowable} instance
227227 * @throws NullPointerException if {@code unit} is {@code null}
228+ * @throws IllegalArgumentException if {@code subscriberCount} is non-positive
228229 * @see #refCount(int, long, TimeUnit, Scheduler)
229230 * @since 2.2
230231 */
@@ -252,7 +253,7 @@ public final Flowable<T> refCount(int subscriberCount, long timeout, @NonNull Ti
252253 * @param timeout the time to wait before disconnecting after all subscribers unsubscribed
253254 * @param unit the time unit of the timeout
254255 * @param scheduler the target scheduler to wait on before disconnecting
255- * @return the new Flowable instance
256+ * @return the new {@link Flowable} instance
256257 * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
257258 * @throws IllegalArgumentException if {@code subscriberCount} is non-positive
258259 * @since 2.2
@@ -269,20 +270,20 @@ public final Flowable<T> refCount(int subscriberCount, long timeout, @NonNull Ti
269270 }
270271
271272 /**
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.
274275 * <p>
275276 * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
276277 * <p>
277278 * 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
280281 * 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.
282283 * <p>
283284 * This overload does not allow disconnecting the connection established via
284285 * {@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.
286287 * <dl>
287288 * <dt><b>Backpressure:</b></dt>
288289 * <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
291292 * <dd>{@code autoConnect} does not operate by default on a particular {@link Scheduler}.</dd>
292293 * </dl>
293294 *
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
296297 * @see #refCount()
297298 * @see #autoConnect(int, Consumer)
298299 */
@@ -304,20 +305,20 @@ public Flowable<T> autoConnect() {
304305 return autoConnect (1 );
305306 }
306307 /**
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.
309310 * <p>
310311 * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
311312 * <p>
312313 * 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
315316 * 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.
317318 * <p>
318319 * This overload does not allow disconnecting the connection established via
319320 * {@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.
321322 * <dl>
322323 * <dt><b>Backpressure:</b></dt>
323324 * <dd>The operator itself doesn't interfere with backpressure which is determined by
@@ -327,10 +328,10 @@ public Flowable<T> autoConnect() {
327328 * </dl>
328329 *
329330 * @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
331332 * 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
334335 */
335336 @ NonNull
336337 @ CheckReturnValue
@@ -341,17 +342,17 @@ public Flowable<T> autoConnect(int numberOfSubscribers) {
341342 }
342343
343344 /**
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.
347348 * <p>
348349 * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
349350 * <p>
350351 * 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
353354 * 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.
355356 * <dl>
356357 * <dt><b>Backpressure:</b></dt>
357358 * <dd>The operator itself doesn't interfere with backpressure which is determined by
@@ -361,13 +362,13 @@ public Flowable<T> autoConnect(int numberOfSubscribers) {
361362 * </dl>
362363 *
363364 * @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
365366 * 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
367368 * 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
371372 * @throws NullPointerException if {@code connection} is {@code null}
372373 */
373374 @ NonNull
0 commit comments