use of io.reactivex.rxjava3.processors.UnicastProcessor in project RxJava by ReactiveX.
the class FlowableObserveOnTest method outputFusedCancelReentrant.
@Test
public void outputFusedCancelReentrant() throws Exception {
final UnicastProcessor<Integer> up = UnicastProcessor.create();
final CountDownLatch cdl = new CountDownLatch(1);
up.observeOn(Schedulers.single()).subscribe(new FlowableSubscriber<Integer>() {
Subscription upstream;
int count;
@Override
public void onSubscribe(Subscription s) {
this.upstream = s;
((QueueSubscription<?>) s).requestFusion(QueueFuseable.ANY);
}
@Override
public void onNext(Integer value) {
if (++count == 1) {
up.onNext(2);
upstream.cancel();
cdl.countDown();
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
up.onNext(1);
cdl.await();
}
use of io.reactivex.rxjava3.processors.UnicastProcessor in project RxJava by ReactiveX.
the class UnicastProcessorTest method onTerminateCalledWhenCanceled.
@Test
public void onTerminateCalledWhenCanceled() {
final AtomicBoolean didRunOnTerminate = new AtomicBoolean();
UnicastProcessor<Integer> up = UnicastProcessor.create(Observable.bufferSize(), new Runnable() {
@Override
public void run() {
didRunOnTerminate.set(true);
}
});
final Disposable subscribe = up.subscribe();
assertFalse(didRunOnTerminate.get());
subscribe.dispose();
assertTrue(didRunOnTerminate.get());
}
use of io.reactivex.rxjava3.processors.UnicastProcessor in project RxJava by ReactiveX.
the class UnicastProcessorTckTest method createFailedPublisher.
@Override
public Publisher<Integer> createFailedPublisher() {
UnicastProcessor<Integer> up = UnicastProcessor.create();
up.onError(new TestException());
return up;
}
use of io.reactivex.rxjava3.processors.UnicastProcessor in project RxJava3_BuildMatrix by akarnokd.
the class FlowableObserveOnTest method outputFusedCancelReentrant.
@Test
public void outputFusedCancelReentrant() throws Exception {
final UnicastProcessor<Integer> up = UnicastProcessor.create();
final CountDownLatch cdl = new CountDownLatch(1);
up.observeOn(Schedulers.single()).subscribe(new FlowableSubscriber<Integer>() {
Subscription upstream;
int count;
@Override
public void onSubscribe(Subscription s) {
this.upstream = s;
((QueueSubscription<?>) s).requestFusion(QueueFuseable.ANY);
}
@Override
public void onNext(Integer value) {
if (++count == 1) {
up.onNext(2);
upstream.cancel();
cdl.countDown();
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
up.onNext(1);
cdl.await();
}
use of io.reactivex.rxjava3.processors.UnicastProcessor in project RxJava3_BuildMatrix by akarnokd.
the class UnicastProcessorTckTest method createFailedPublisher.
@Override
public Publisher<Integer> createFailedPublisher() {
UnicastProcessor<Integer> up = UnicastProcessor.create();
up.onError(new TestException());
return up;
}
Aggregations