use of io.reactivex.rxjava3.core.Scheduler in project RxAndroid by ReactiveX.
the class AndroidSchedulersTest method mainThreadAsyncMessagesByDefault.
@Test
public void mainThreadAsyncMessagesByDefault() {
ShadowLooper mainLooper = shadowOf(Looper.getMainLooper());
mainLooper.pause();
ShadowMessageQueue mainMessageQueue = shadowOf(Looper.getMainLooper().getQueue());
Scheduler main = AndroidSchedulers.mainThread();
main.scheduleDirect(new Runnable() {
@Override
public void run() {
}
});
Message message = mainMessageQueue.getHead();
assertTrue(message.isAsynchronous());
}
use of io.reactivex.rxjava3.core.Scheduler in project RxJava by ReactiveX.
the class FlowableInterval method subscribeActual.
@Override
public void subscribeActual(Subscriber<? super Long> s) {
IntervalSubscriber is = new IntervalSubscriber(s);
s.onSubscribe(is);
Scheduler sch = scheduler;
if (sch instanceof TrampolineScheduler) {
Worker worker = sch.createWorker();
is.setResource(worker);
worker.schedulePeriodically(is, initialDelay, period, unit);
} else {
Disposable d = sch.schedulePeriodicallyDirect(is, initialDelay, period, unit);
is.setResource(d);
}
}
use of io.reactivex.rxjava3.core.Scheduler in project RxJava by ReactiveX.
the class ObservableIntervalRange method subscribeActual.
@Override
public void subscribeActual(Observer<? super Long> observer) {
IntervalRangeObserver is = new IntervalRangeObserver(observer, start, end);
observer.onSubscribe(is);
Scheduler sch = scheduler;
if (sch instanceof TrampolineScheduler) {
Worker worker = sch.createWorker();
is.setResource(worker);
worker.schedulePeriodically(is, initialDelay, period, unit);
} else {
Disposable d = sch.schedulePeriodicallyDirect(is, initialDelay, period, unit);
is.setResource(d);
}
}
use of io.reactivex.rxjava3.core.Scheduler in project RxJava by ReactiveX.
the class ObservableBufferTimed method subscribeActual.
@Override
protected void subscribeActual(Observer<? super U> t) {
if (timespan == timeskip && maxSize == Integer.MAX_VALUE) {
source.subscribe(new BufferExactUnboundedObserver<>(new SerializedObserver<>(t), bufferSupplier, timespan, unit, scheduler));
return;
}
Scheduler.Worker w = scheduler.createWorker();
if (timespan == timeskip) {
source.subscribe(new BufferExactBoundedObserver<>(new SerializedObserver<>(t), bufferSupplier, timespan, unit, maxSize, restartTimerOnMaxSize, w));
return;
}
// Can't use maxSize because what to do if a buffer is full but its
// timespan hasn't been elapsed?
source.subscribe(new BufferSkipBoundedObserver<>(new SerializedObserver<>(t), bufferSupplier, timespan, timeskip, unit, w));
}
use of io.reactivex.rxjava3.core.Scheduler in project RxJava by ReactiveX.
the class FlowableIntervalRange method subscribeActual.
@Override
public void subscribeActual(Subscriber<? super Long> s) {
IntervalRangeSubscriber is = new IntervalRangeSubscriber(s, start, end);
s.onSubscribe(is);
Scheduler sch = scheduler;
if (sch instanceof TrampolineScheduler) {
Worker worker = sch.createWorker();
is.setResource(worker);
worker.schedulePeriodically(is, initialDelay, period, unit);
} else {
Disposable d = sch.schedulePeriodicallyDirect(is, initialDelay, period, unit);
is.setResource(d);
}
}
Aggregations