3434 * before the {@code Flowable} begins emitting items.
3535 * <p>
3636 * <img width="640" height="510" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.png" alt="">
37- *
37+ * <p>
38+ * When the upstream terminates, the {@code ConnectableFlowable} remains in this terminated state and,
39+ * depending on the actual underlying implementation, relays cached events to late {@link Subscriber}s.
40+ * In order to reuse and restart this {@code ConnectableFlowable}, the {@link #reset()} method has to be called.
41+ * When called, this {@code ConnectableFlowable} will appear as fresh, unconnected source to new {@link Subscriber}s.
42+ * Disposing the connection will reset the {@code ConnectableFlowable} to its fresh state and there is no need to call
43+ * {@code reset()} in this case.
44+ * <p>
45+ * Note that although {@link #connect()} and {@link #reset()} are safe to call from multiple threads, it is recommended
46+ * a dedicated thread or business logic manages the connection or resetting of a {@code ConnectableFlowable} so that
47+ * there is no unwanted signal loss due to early {@code connect()} or {@code reset()} calls while {@code Subscriber}s are
48+ * still being subscribed to to this {@code ConnectableFlowable} to receive signals from the get go.
49+ * <p>
3850 * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators">RxJava Wiki:
3951 * Connectable Observable Operators</a>
4052 * @param <T>
4153 * the type of items emitted by the {@code ConnectableFlowable}
54+ * @since 2.0.0
4255 */
4356public abstract class ConnectableFlowable <T > extends Flowable <T > {
4457
@@ -53,6 +66,14 @@ public abstract class ConnectableFlowable<T> extends Flowable<T> {
5366 */
5467 public abstract void connect (@ NonNull Consumer <? super Disposable > connection );
5568
69+ /**
70+ * Resets this ConnectableFlowable into its fresh state if it has terminated.
71+ * <p>
72+ * Calling this method on a fresh or active {@code ConnectableFlowable} has no effect.
73+ * @since 3.0.0
74+ */
75+ public abstract void reset ();
76+
5677 /**
5778 * Instructs the {@code ConnectableFlowable} to begin emitting the items from its underlying
5879 * {@link Flowable} to its {@link Subscriber}s.
0 commit comments