Search in sources :

Example 1 with IoScheduler

use of io.reactivex.rxjava3.internal.schedulers.IoScheduler in project RxJava by ReactiveX.

the class FlowableMergeMaxConcurrentTest method simpleAsyncLoop.

@Test
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);
        }
    }
}
Also used : IoScheduler(io.reactivex.rxjava3.internal.schedulers.IoScheduler) Test(org.junit.Test)

Example 2 with IoScheduler

use of io.reactivex.rxjava3.internal.schedulers.IoScheduler in project RxJava by ReactiveX.

the class CachedThreadSchedulerTest method shutdownRejects.

@Test
@SuppressUndeliverable
public void shutdownRejects() {
    final int[] calls = { 0 };
    Runnable r = new Runnable() {

        @Override
        public void run() {
            calls[0]++;
        }
    };
    IoScheduler s = new IoScheduler();
    s.shutdown();
    s.shutdown();
    s.scheduleDirect(r);
    s.scheduleDirect(r, 1, TimeUnit.SECONDS);
    s.schedulePeriodicallyDirect(r, 1, 1, TimeUnit.SECONDS);
    Worker w = s.createWorker();
    w.dispose();
    assertEquals(Disposable.disposed(), w.schedule(r));
    assertEquals(Disposable.disposed(), w.schedule(r, 1, TimeUnit.SECONDS));
    assertEquals(Disposable.disposed(), w.schedulePeriodically(r, 1, 1, TimeUnit.SECONDS));
    assertEquals(0, calls[0]);
}
Also used : IoScheduler(io.reactivex.rxjava3.internal.schedulers.IoScheduler) Worker(io.reactivex.rxjava3.core.Scheduler.Worker) Test(org.junit.Test) SuppressUndeliverable(io.reactivex.rxjava3.testsupport.SuppressUndeliverable)

Example 3 with IoScheduler

use of io.reactivex.rxjava3.internal.schedulers.IoScheduler in project RxJava by ReactiveX.

the class ObservableMergeMaxConcurrentTest method simpleAsyncLoop.

@Test
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);
        }
    }
}
Also used : IoScheduler(io.reactivex.rxjava3.internal.schedulers.IoScheduler)

Aggregations

IoScheduler (io.reactivex.rxjava3.internal.schedulers.IoScheduler)3 Test (org.junit.Test)2 Worker (io.reactivex.rxjava3.core.Scheduler.Worker)1 SuppressUndeliverable (io.reactivex.rxjava3.testsupport.SuppressUndeliverable)1