src/main/java/io/reactivex/flowables/ConnectableFlowable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.CUSTOM)
    @BackpressureSupport(BackpressureKind.PASS_THROUGH)
    public final Flowable<T> refCount(int subscriberCount, long timeout, TimeUnit unit, Scheduler scheduler) {
        ObjectHelper.verifyPositive(subscriberCount, "subscriberCount");
        ObjectHelper.requireNonNull(unit, "unit is null");
        ObjectHelper.requireNonNull(scheduler, "scheduler is null");
        return RxJavaPlugins.onAssembly(new FlowableRefCount<T>(this, subscriberCount, timeout, unit, scheduler));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.CUSTOM)
    @BackpressureSupport(BackpressureKind.PASS_THROUGH)
    public final Flowable<T> refCount(int subscriberCount, long timeout, TimeUnit unit, Scheduler scheduler) {
        ObjectHelper.verifyPositive(subscriberCount, "subscriberCount");
        ObjectHelper.requireNonNull(unit, "unit is null");
        ObjectHelper.requireNonNull(scheduler, "scheduler is null");
        return RxJavaPlugins.onAssembly(new FlowableRefCount<T>(this, subscriberCount, timeout, unit, scheduler));
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) public final Flowable < T > refCount ( int subscriberCount , long timeout , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . verifyPositive ( subscriberCount , "subscriberCount" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableRefCount < T > ( this , subscriberCount , timeout , unit , scheduler ) ) ; }
Connects to the upstream {@code ConnectableFlowable} if the number of subscribed
subscriber reaches the specified count and disconnect after the specified
timeout if all subscribers have unsubscribed.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator itself doesn't interfere with backpressure which is determined by the upstream
{@code ConnectableFlowable}'s backpressure behavior.</dd>
<dt><b>Scheduler:</b></dt>
<dd>This {@code refCount} overload operates on the specified {@link Scheduler}.</dd>
</dl>
<p>History: 2.1.14 - experimental
@param subscriberCount the number of subscribers required to connect to the upstream
@param timeout the time to wait before disconnecting after all subscribers unsubscribed
@param unit the time unit of the timeout
@param scheduler the target scheduler to wait on before disconnecting
@return the new Flowable instance
@since 2.2
Connects to the upstream {