APISonar


io.reactivex.rxjava3.schedulers.Schedulers.io

> io > reactivex > rxjava3 > schedulers > Schedulers > io
io APIs reactivex APIs rxjava3 APIs schedulers APIs Schedulers APIs io APIs

Example 1
public void take() throws Exception {
        List<Observable<Integer>> sourceList = new ArrayList<Observable<Integer>>(3);

        sourceList.add(Observable.range(0, 100000).subscribeOn(Schedulers.io()));
        sourceList.add(Observable.range(0, 100000).subscribeOn(Schedulers.io()));
        sourceList.add(Observable.range(0, 100000).subscribeOn(Schedulers.io()));

        TestObserver<Integer> to = new TestObserver<Integer>();

        Observable.merge(sourceList, 2).take(5).subscribe(to);

        to.awaitDone(5, TimeUnit.SECONDS);
        to.assertNoErrors();
        to.assertValueCount(5);
    }
Example 2
public void take() throws Exception {
        List<Flowable<Integer>> sourceList = new ArrayList<Flowable<Integer>>(3);

        sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io()));
        sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io()));
        sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io()));

        TestSubscriber<Integer> ts = new TestSubscriber<Integer>();

        Flowable.merge(sourceList, 2).take(5).subscribe(ts);

        ts.awaitDone(5, TimeUnit.SECONDS);
        ts.assertNoErrors();
        ts.assertValueCount(5);
    }
Example 3
public void withObserveOn() throws InterruptedException {
        TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
        Flowable.range(0, Flowable.bufferSize() * 10).onBackpressureDrop().observeOn(Schedulers.io()).subscribe(ts);
        ts.awaitDone(5, TimeUnit.SECONDS);
    }
Example 4
public void simpleAsyncLoop() {
        IoScheduler ios = (IoScheduler)Schedulers.io();
        int c = ios.size();
        for (int i = 0; i < 200; i++) {
            simpleAsync();
            int c1 = ios.size();
            if (c + 60 < c1) {
                throw new AssertionError("Worker leak: " + c + " - " + c1);
            }
        }
    }