@@ -78,19 +78,45 @@ public Flowable<T> refCount() {
78
78
}
79
79
80
80
/**
81
- * Returns a Flowable that automatically connects to this ConnectableFlowable
81
+ * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
82
82
* when the first Subscriber subscribes.
83
+ * <p>
84
+ * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
85
+ * <p>
86
+ * The connection happens after the first subscription and happens at most once
87
+ * during the lifetime of the returned Flowable. If this ConnectableFlowable
88
+ * terminates, the connection is never renewed, no matter how Subscribers come
89
+ * and go. Use {@link #refCount()} to renew a connection or dispose an active
90
+ * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
91
+ * <p>
92
+ * This overload does not allow disconnecting the connection established via
93
+ * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload
94
+ * to gain access to the {@code Disposable} representing the only connection.
83
95
*
84
96
* @return a Flowable that automatically connects to this ConnectableFlowable
85
97
* when the first Subscriber subscribes
98
+ * @see #refCount()
99
+ * @see #autoConnect(int, Consumer)
86
100
*/
87
101
@ NonNull
88
102
public Flowable <T > autoConnect () {
89
103
return autoConnect (1 );
90
104
}
91
105
/**
92
- * Returns a Flowable that automatically connects to this ConnectableFlowable
106
+ * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
93
107
* when the specified number of Subscribers subscribe to it.
108
+ * <p>
109
+ * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
110
+ * <p>
111
+ * The connection happens after the given number of subscriptions and happens at most once
112
+ * during the lifetime of the returned Flowable. If this ConnectableFlowable
113
+ * terminates, the connection is never renewed, no matter how Subscribers come
114
+ * and go. Use {@link #refCount()} to renew a connection or dispose an active
115
+ * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
116
+ * <p>
117
+ * This overload does not allow disconnecting the connection established via
118
+ * {@link #connect(Consumer)}. Use the {@link #autoConnect(int, Consumer)} overload
119
+ * to gain access to the {@code Disposable} representing the only connection.
94
120
*
95
121
* @param numberOfSubscribers the number of subscribers to await before calling connect
96
122
* on the ConnectableFlowable. A non-positive value indicates
@@ -104,9 +130,17 @@ public Flowable<T> autoConnect(int numberOfSubscribers) {
104
130
}
105
131
106
132
/**
107
- * Returns a Flowable that automatically connects to this ConnectableFlowable
133
+ * Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable
108
134
* when the specified number of Subscribers subscribe to it and calls the
109
135
* specified callback with the Subscription associated with the established connection.
136
+ * <p>
137
+ * <img width="640" height="392" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/autoConnect.f.png" alt="">
138
+ * <p>
139
+ * The connection happens after the given number of subscriptions and happens at most once
140
+ * during the lifetime of the returned Flowable. If this ConnectableFlowable
141
+ * terminates, the connection is never renewed, no matter how Subscribers come
142
+ * and go. Use {@link #refCount()} to renew a connection or dispose an active
143
+ * connection when all {@code Subscriber}s have cancelled their {@code Subscription}s.
110
144
*
111
145
* @param numberOfSubscribers the number of subscribers to await before calling connect
112
146
* on the ConnectableFlowable. A non-positive value indicates
0 commit comments