use of io.reactivex.internal.operators.flowable.FlowableSubscribeOn.SubscribeOnSubscriber in project RxJava by ReactiveX.
the class FlowableSubscribeOnTest method deferredRequestRace.
@Test
public void deferredRequestRace() {
for (int i = 0; i < 500; i++) {
final TestSubscriber<Integer> ts = new TestSubscriber<Integer>(0L);
Worker w = Schedulers.computation().createWorker();
final SubscribeOnSubscriber<Integer> so = new SubscribeOnSubscriber<Integer>(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