Search in sources :

Example 6 with SequentialDisposable

use of io.reactivex.rxjava3.internal.disposables.SequentialDisposable in project RxJava by ReactiveX.

the class ObservableRepeatUntil method subscribeActual.

@Override
public void subscribeActual(Observer<? super T> observer) {
    SequentialDisposable sd = new SequentialDisposable();
    observer.onSubscribe(sd);
    RepeatUntilObserver<T> rs = new RepeatUntilObserver<>(observer, until, sd, source);
    rs.subscribeNext();
}
Also used : SequentialDisposable(io.reactivex.rxjava3.internal.disposables.SequentialDisposable)

Example 7 with SequentialDisposable

use of io.reactivex.rxjava3.internal.disposables.SequentialDisposable in project RxJava by ReactiveX.

the class ObservableRetryBiPredicate method subscribeActual.

@Override
public void subscribeActual(Observer<? super T> observer) {
    SequentialDisposable sa = new SequentialDisposable();
    observer.onSubscribe(sa);
    RetryBiObserver<T> rs = new RetryBiObserver<>(observer, predicate, sa, source);
    rs.subscribeNext();
}
Also used : SequentialDisposable(io.reactivex.rxjava3.internal.disposables.SequentialDisposable)

Example 8 with SequentialDisposable

use of io.reactivex.rxjava3.internal.disposables.SequentialDisposable in project RxJava by ReactiveX.

the class ObservableDelaySubscriptionOther method subscribeActual.

@Override
public void subscribeActual(final Observer<? super T> child) {
    final SequentialDisposable serial = new SequentialDisposable();
    child.onSubscribe(serial);
    Observer<U> otherObserver = new DelayObserver(serial, child);
    other.subscribe(otherObserver);
}
Also used : SequentialDisposable(io.reactivex.rxjava3.internal.disposables.SequentialDisposable)

Example 9 with SequentialDisposable

use of io.reactivex.rxjava3.internal.disposables.SequentialDisposable in project RxJava by ReactiveX.

the class SingleDelay method subscribeActual.

@Override
protected void subscribeActual(final SingleObserver<? super T> observer) {
    final SequentialDisposable sd = new SequentialDisposable();
    observer.onSubscribe(sd);
    source.subscribe(new Delay(sd, observer));
}
Also used : SequentialDisposable(io.reactivex.rxjava3.internal.disposables.SequentialDisposable)

Example 10 with SequentialDisposable

use of io.reactivex.rxjava3.internal.disposables.SequentialDisposable in project RxJava by ReactiveX.

the class AbstractSchedulerTests method schedulePeriodicallyZeroPeriod.

@Test
public void schedulePeriodicallyZeroPeriod() throws Exception {
    Scheduler s = getScheduler();
    if (s instanceof TrampolineScheduler) {
        // can't properly stop a trampolined periodic task
        return;
    }
    for (int initial = 0; initial < 2; initial++) {
        final CountDownLatch cdl = new CountDownLatch(1);
        final SequentialDisposable sd = new SequentialDisposable();
        Scheduler.Worker w = s.createWorker();
        try {
            sd.replace(w.schedulePeriodically(new Runnable() {

                int count;

                @Override
                public void run() {
                    if (++count == 10) {
                        sd.dispose();
                        cdl.countDown();
                    }
                }
            }, initial, 0, TimeUnit.MILLISECONDS));
            assertTrue("" + initial, cdl.await(5, TimeUnit.SECONDS));
        } finally {
            sd.dispose();
            w.dispose();
        }
    }
}
Also used : Worker(io.reactivex.rxjava3.core.Scheduler.Worker) TrampolineScheduler(io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler) SequentialDisposable(io.reactivex.rxjava3.internal.disposables.SequentialDisposable) TrampolineScheduler(io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler) Test(org.junit.Test)

Aggregations

SequentialDisposable (io.reactivex.rxjava3.internal.disposables.SequentialDisposable)8 Test (org.junit.Test)5 Worker (io.reactivex.rxjava3.core.Scheduler.Worker)2 Disposable (io.reactivex.rxjava3.disposables.Disposable)2 TrampolineScheduler (io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler)2 Scheduler (io.reactivex.rxjava3.core.Scheduler)1