use of io.reactivex.rxjava3.internal.operators.flowable.FlowableSubscribeOn.SubscribeOnSubscriber in project RxJava by ReactiveX.
the class FlowableSubscribeOnTest method deferredRequestRace.
@Test
public void deferredRequestRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
final TestSubscriber<Integer> ts = new TestSubscriber<>(0L);
Worker w = Schedulers.computation().createWorker();
final SubscribeOnSubscriber<Integer> so = new SubscribeOnSubscriber<>(ts, w, Flowable.<Integer>never(), true);
ts.onSubscribe(so);
final BooleanSubscription bs = new BooleanSubscription();
try {
Runnable r1 = new Runnable() {
@Override
public void run() {
so.onSubscribe(bs);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
so.request(1);
}
};
TestHelper.race(r1, r2);
} finally {
w.dispose();
}
}
}
Aggregations