@Override public void onComplete() { if (!done) { done = true; source.subscribe(new MainSubscriber()); } }
/** * Repeatedly run this Nono at most the given number of times if it fails. * @param times the repeat count * @return the new Nono instance */ public final Nono retry(long times) { return onAssembly(new NonoRetry(this, times)); }
/** * Caches the value or error event of the upstream Perhaps * and relays/replays it to Subscribers. * @return the new Perhaps instance * * @since 0.14.1 */ public final Perhaps<T> cache() { return onAssembly(new PerhapsCache<T>(this)); }
@Override protected void subscribeActual(Subscriber<? super T> s) { source.subscribe(new UnsubscribeOnSubscriber<T>(s, scheduler)); } }
@Override protected void subscribeActual(Subscriber<? super R> s) { source.subscribe(new MapSubscriber<T, R>(s, mapper)); } }
/** * Converts this Perhaps into a Future and signals its single * value or null if this Perhaps is empty. * @return the new Future instance */ public final Future<T> toFuture() { FuturePerhapsSubscriber<T> fs = new FuturePerhapsSubscriber<T>(); subscribe(fs); return fs; } }
/** * 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)); } }
/** * Returns a Solo that never signals an item or terminal event. * @param <T> the value type * @return the new Solo instance */ public static <T> Solo<T> never() { return onAssembly(SoloNever.<T>instance()); }
/** * Hides the identity of this Perhaps instance, including * its subscriber. * <p>This allows preventing cerain optimizations as well * for diagnostic purposes. * @return the new Perhaps instance */ public final Perhaps<T> hide() { return onAssembly(new PerhapsHide<T>(this)); }
@Override public void cancel() { if (compareAndSet(0, 1)) { remove(this); } } }
/** * Caches the terminal event of the upstream Nono * and relays/replays it to Subscribers. * @return the new Nono instance * * @since 0.14.1 */ public final Nono cache() { return onAssembly(new NonoCache(this)); }
/** * Returns an empty Perhaps. * @param <T> the value type * @return the shared Perhaps instance */ public static <T> Perhaps<T> empty() { return onAssembly(PerhapsEmpty.<T>instance()); }
/** * Completes in case the upstream signals an error. * @return the new Perhaps instance */ public final Perhaps<T> onErrorComplete() { return onAssembly(new PerhapsOnErrorReturnItem<T>(this, null)); }
/** * Retry this Solo indefinitely if it fails. * @return the new Solo instance */ public final Solo<T> retry() { return onAssembly(new SoloRetry<T>(this, Long.MAX_VALUE)); }
@Override public void cancel() { if (compareAndSet(0, 1)) { parent.delete(this); } }
/** * Returns a Perhaps that never signals any item or terminal event. * @param <T> the value type * @return the shared Perhaps instance */ public static <T> Perhaps<T> never() { return onAssembly(PerhapsNever.<T>instance()); }
/** * Repeatedly run this Nono at most the given number of times. * @param times the repeat count * @return the new Nono instance */ public final Nono repeat(long times) { return onAssembly(new NonoRepeat(this, times)); }
/** * Repeatedly run this Nono indefinitely if it fails. * @return the new Nono instance */ public final Nono retry() { return onAssembly(new NonoRetry(this, Long.MAX_VALUE)); }