@Test public void testAsync() { Flowable<Integer> source = Flowable.range(1, 10000); for (int i = 0; i < 100; i++) { TestSubscriber<Integer> ts1 = new TestSubscriber<Integer>(); Flowable<Integer> cached = source.replay().autoConnect(); cached.observeOn(Schedulers.computation()).subscribe(ts1); ts1.awaitTerminalEvent(2, TimeUnit.SECONDS); ts1.assertNoErrors(); ts1.assertTerminated(); assertEquals(10000, ts1.values().size()); TestSubscriber<Integer> ts2 = new TestSubscriber<Integer>(); cached.observeOn(Schedulers.computation()).subscribe(ts2); ts2.awaitTerminalEvent(2, TimeUnit.SECONDS); ts2.assertNoErrors(); ts2.assertTerminated(); assertEquals(10000, ts2.values().size()); } }
public static <T> ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler) { final Flowable<T> observable = cf.observeOn(scheduler); return RxJavaPlugins.onAssembly(new ConnectableFlowableReplay<T>(cf, observable)); }
FlowableReplay extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>, Disposable { public static <T> ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler) { final Flowable<T> observable = cf.observeOn(scheduler); return RxJavaPlugins.onAssembly(new ConnectableFlowableReplay<T>(cf, observable)); } }
FlowableReplay extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>, Disposable { public static <T> ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler) { final Flowable<T> observable = cf.observeOn(scheduler); return RxJavaPlugins.onAssembly(new ConnectableFlowableReplay<T>(cf, observable)); } private  FlowableReplay(Publisher<T> onSubscribe, Flowable<T> source,
            final AtomicReference<ReplaySubscriber<T>> current,
            final Callable<? extends ReplayBuffer<T>> bufferFactory); }
FlowableReplay extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>, Disposable { public static <T> ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler) { final Flowable<T> observable = cf.observeOn(scheduler); return RxJavaPlugins.onAssembly(new ConnectableFlowableReplay<T>(cf, observable)); } private  FlowableReplay(Publisher<T> onSubscribe, Flowable<T> source,
            final AtomicReference<ReplaySubscriber<T>> current,
            final Callable<? extends ReplayBuffer<T>> bufferFactory); static Flowable<R> multicastSelector(
            final Callable<? extends ConnectableFlowable<U>> connectableFactory,
            final Function<? super Flowable<U>, ? extends Publisher<R>> selector); static ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler); @SuppressWarnings("unchecked") static ConnectableFlowable<T> createFrom(Flowable<? extends T> source); static ConnectableFlowable<T> create(Flowable<T> source,
            final int bufferSize); static ConnectableFlowable<T> create(Flowable<T> source,
            long maxAge, TimeUnit unit, Scheduler scheduler); static ConnectableFlowable<T> create(Flowable<T> source,
            final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize); @Override Publisher<T> source(); @Override void dispose(); @Override boolean isDisposed(); @Override void connect(Consumer<? super Disposable> connection); }
FlowableReplay extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>, Disposable { public static <T> ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler) { final Flowable<T> observable = cf.observeOn(scheduler); return RxJavaPlugins.onAssembly(new ConnectableFlowableReplay<T>(cf, observable)); } private  FlowableReplay(Publisher<T> onSubscribe, Flowable<T> source,
            final AtomicReference<ReplaySubscriber<T>> current,
            final Callable<? extends ReplayBuffer<T>> bufferFactory); static Flowable<R> multicastSelector(
            final Callable<? extends ConnectableFlowable<U>> connectableFactory,
            final Function<? super Flowable<U>, ? extends Publisher<R>> selector); static ConnectableFlowable<T> observeOn(final ConnectableFlowable<T> cf, final Scheduler scheduler); @SuppressWarnings("unchecked") static ConnectableFlowable<T> createFrom(Flowable<? extends T> source); static ConnectableFlowable<T> create(Flowable<T> source,
            final int bufferSize); static ConnectableFlowable<T> create(Flowable<T> source,
            long maxAge, TimeUnit unit, Scheduler scheduler); static ConnectableFlowable<T> create(Flowable<T> source,
            final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize); @Override Publisher<T> source(); @Override void dispose(); @Override boolean isDisposed(); @Override void connect(Consumer<? super Disposable> connection);  }