ConnectableFlowable
ConnectableFlowable resembles an ordinary Flowable, except that it does not begin
emitting items when it is subscribed to, but only when its connect method is called. In this way you
can wait for all intended Subscribers to Flowable#subscribe to the Flowable
before the Flowable begins emitting items.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Flowable | Returns: a Flowable that automatically connects to this ConnectableFlowable when the first Subscriber subscribesReturns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the first Subscriber subscribes. |
| public Flowable | Returns: a Flowable that automatically connects to this ConnectableFlowable when the specified number of Subscribers subscribe to itthe number of subscribers to await before calling connect
on the ConnectableFlowable. A non-positive value indicates
an immediate connection. numberOfSubscribers)Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the specified number of Subscribers subscribe to it. |
| public Flowable | Returns: a Flowable that automatically connects to this ConnectableFlowable when the specified number of Subscribers subscribe to it and calls the specified callback with the Subscription associated with the established connectionthe number of subscribers to await before calling connect
on the ConnectableFlowable. A non-positive value indicates
an immediate connection. numberOfSubscribers, Consumer<? super Disposable> the callback Consumer that will receive the Subscription representing the
established connection connection)Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the specified number of Subscribers subscribe to it and calls the specified callback with the Subscription associated with the established connection. |
| public abstract void | connect(Consumer<? super Disposable>
the action that receives the connection subscription before the subscription to source happens
allowing the caller to synchronously disconnect a synchronous source connection)Instructs the |
| public final Disposable | Returns: the subscription representing the connectionInstructs the |
| private ConnectableFlowable | Returns: the ConnectableFlowable to work withApply a workaround for a race condition with the regular publish().refCount() so that racing subscribers and refCount won't hang. |
| public Flowable | |
| public final Flowable | Returns: the new Flowable instancethe number of subscribers required to connect to the upstream subscriberCount)Connects to the upstream |
| public final Flowable | Returns: the new Flowable instancethe time to wait before disconnecting after all subscribers unsubscribed timeout, TimeUnit the time unit of the timeout unit)Connects to the upstream |
| public final Flowable | Returns: the new Flowable instancethe time to wait before disconnecting after all subscribers unsubscribed timeout, TimeUnit the time unit of the timeout unit, Scheduler the target scheduler to wait on before disconnecting scheduler)Connects to the upstream |
| public final Flowable | Returns: the new Flowable instancethe number of subscribers required to connect to the upstream subscriberCount, long the time to wait before disconnecting after all subscribers unsubscribed timeout, TimeUnit the time unit of the timeout unit)Connects to the upstream |
| public final Flowable | Returns: the new Flowable instancethe number of subscribers required to connect to the upstream subscriberCount, long the time to wait before disconnecting after all subscribers unsubscribed timeout, TimeUnit the time unit of the timeout unit, Scheduler the target scheduler to wait on before disconnecting scheduler)Connects to the upstream |
| ConnectableFlowable | back to summary |
|---|---|
| public ConnectableFlowable() | |
| autoConnect | back to summary |
|---|---|
| public Flowable Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the first Subscriber subscribes.
The connection happens after the first subscription and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use
This overload does not allow disconnecting the connection established via
| |
| autoConnect | back to summary |
|---|---|
| public Flowable Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the specified number of Subscribers subscribe to it.
The connection happens after the given number of subscriptions and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use
This overload does not allow disconnecting the connection established via
| |
| autoConnect | back to summary |
|---|---|
| public Flowable Returns a Flowable that automatically connects (at most once) to this ConnectableFlowable when the specified number of Subscribers subscribe to it and calls the specified callback with the Subscription associated with the established connection.
The connection happens after the given number of subscriptions and happens at most once
during the lifetime of the returned Flowable. If this ConnectableFlowable
terminates, the connection is never renewed, no matter how Subscribers come
and go. Use
| |
| connect | back to summary |
|---|---|
| public abstract void connect(Consumer<? super Disposable> connection) Instructs the
| |
| connect | back to summary |
|---|---|
| public final Disposable connect() Instructs the
To disconnect from a synchronous source, use the
| |
| onRefCount | back to summary |
|---|---|
| private ConnectableFlowable Apply a workaround for a race condition with the regular publish().refCount() so that racing subscribers and refCount won't hang.
| |
| refCount | back to summary |
|---|---|
| public Flowable Returns a
| |
| refCount | back to summary |
|---|---|
| public final Flowable Connects to the upstream
History: 2.1.14 - experimental
| |
| refCount | back to summary |
|---|---|
| public final Flowable Connects to the upstream
History: 2.1.14 - experimental
| |
| refCount | back to summary |
|---|---|
| public final Flowable Connects to the upstream
History: 2.1.14 - experimental
| |
| refCount | back to summary |
|---|---|
| public final Flowable Connects to the upstream
History: 2.1.14 - experimental
| |
| refCount | back to summary |
|---|---|
| public final Flowable Connects to the upstream
History: 2.1.14 - experimental
| |