@Override public void run() { source.subscribe(this); } }
/** * Subscribe to this Nono and ignore the events it produces. * @return the Disposable to cancel the subscription * @since 0.13.0 */ public final Disposable subscribe() { return subscribe(Functions.EMPTY_ACTION, Functions.ERROR_CONSUMER); }
/** * Subscribe to this Nono and execute the given action if this Nono * completes. * @param onComplete the callback Action to be called when this Nono * completes * @return the Disposable to cancel the subscription */ @SchedulerSupport(SchedulerSupport.NONE) public final Disposable subscribe(Action onComplete) { return subscribe(onComplete, Functions.ERROR_CONSUMER); }
/** * Converts this Nono into a Future and signals its single * value. * @return the new Future instance */ public final Future<Void> toFuture() { FuturePerhapsSubscriber<Void> fs = new FuturePerhapsSubscriber<Void>(); subscribe(fs); return fs; } }
@Override protected void subscribeActual(Subscriber<? super Void> s) { source.subscribe(new HideSubscriber<Void>(s)); } }
@Override public void onComplete() { if (!done) { done = true; source.subscribe(new MainSubscriber()); } }
@Override protected void subscribeActual(Subscriber<? super Void> s) { MainSubscriber parent = new MainSubscriber(s, fallback); s.onSubscribe(parent); other.subscribe(parent.other); source.subscribe(parent); }
@Override protected void subscribeActual(Subscriber<? super Void> s) { TakeUntilSubscriber parent = new TakeUntilSubscriber(s); s.onSubscribe(parent); other.subscribe(parent.inner); source.subscribe(parent); }
/** * Create a TestSubscriber, subscribe it to this Nono and return * the TestSubscriber itself. * @return the TestSubscriber created */ @SchedulerSupport(SchedulerSupport.NONE) public final TestSubscriber<Void> test() { TestSubscriber<Void> ts = new TestSubscriber<Void>(); subscribe(ts); return ts; }
void otherComplete() { SubscriptionHelper.cancel(this); if (once.compareAndSet(false, true)) { Nono f = fallback; if (f == null) { downstream.onError(new TimeoutException()); } else { f.subscribe(new FallbackSubscriber()); } } }
void otherComplete() { SubscriptionHelper.cancel(this); if (once.compareAndSet(false, true)) { Nono f = fallback; if (f == null) { downstream.onError(new TimeoutException()); } else { f.subscribe(new FallbackSubscriber()); } } }
@Override protected void subscribeActual(Subscriber<? super Void> s) { Nono np; try { np = ObjectHelper.requireNonNull(supplier.call(), "The supplier returned a null Nono"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); EmptySubscription.error(ex, s); return; } np.subscribe(s); }
@Override public void onNext(Nono t) { getAndIncrement(); MergeInnerSubscriber inner = new MergeInnerSubscriber(); set.add(inner); t.subscribe(inner); }
@Override protected void subscribeActual(Subscriber<? super Void> s) { Subscriber<? super Void> z; try { z = ObjectHelper.requireNonNull(lifter.apply(s), "The lifter returned a null Subscriber"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); EmptySubscription.error(ex, s); return; } source.subscribe(z); }
@Test public void subscribe2Error() { ioError .subscribe(this, this); Assert.assertEquals(1, count); }
@Test public void subscribe1() { Nono.complete() .subscribe(this); Assert.assertEquals(1, count); }
@Test public void subscribe() { Nono.fromAction(this).subscribe(); Assert.assertEquals(1, count); }
@Test public void subscribe2() { Nono.complete() .subscribe(this, this); Assert.assertEquals(1, count); }
@Test public void subscribeError() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { ioError.subscribe(); TestHelper.assertUndeliverable(errors, 0, IOException.class); } finally { RxJavaPlugins.reset(); } }
@Test public void subscribe1Error() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { ioError .subscribe(this); Assert.assertEquals(0, count); TestHelper.assertUndeliverable(errors, 0, IOException.class); } finally { RxJavaPlugins.reset(); } }