/** * Repeatedly re-subscribes to the current Single indefinitely if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry() { return toSingle(toFlowable().retry()); }
/** * Converts a {@link Future} into a {@code Single}. * <p> * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.from.Future.png" alt=""> * <p> * You can convert any object that supports the {@link Future} interface into a Single that emits the return * value of the {@link Future#get} method of that object, by passing the object into the {@code from} * method. * <p> * <em>Important note:</em> This Single is blocking; you cannot dispose it. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param future * the source {@link Future} * @param <T> * the type of object that the {@link Future} returns, and also the type of item to be emitted by * the resulting {@code Single} * @return a {@code Single} that emits the item from the source {@link Future} * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromFuture(Future<? extends T> future) { return toSingle(Flowable.<T>fromFuture(future)); }
/** * Converts a {@link Future}, operating on a specified {@link Scheduler}, into a {@code Single}. * <p> * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.from.Future.s.png" alt=""> * <p> * You can convert any object that supports the {@link Future} interface into a {@code Single} that emits * the return value of the {@link Future#get} method of that object, by passing the object into the * {@code from} method. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>You specify which {@link Scheduler} this operator will use.</dd> * </dl> * * @param future * the source {@link Future} * @param scheduler * the {@link Scheduler} to wait for the Future on. Use a Scheduler such as * {@link Schedulers#io()} that can block and wait on the Future * @param <T> * the type of object that the {@link Future} returns, and also the type of item to be emitted by * the resulting {@code Single} * @return a {@code Single} that emits the item from the source {@link Future} * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Single<T> fromFuture(Future<? extends T> future, Scheduler scheduler) { return toSingle(Flowable.<T>fromFuture(future, scheduler)); }
@SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit) { return toSingle(Flowable.<T>fromFuture(future, timeout, unit));
/** * Repeatedly re-subscribe at most the specified times to the current Single * if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param times the number of times to resubscribe if the current Single fails * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(long times) { return toSingle(toFlowable().retry(times)); }
/** * Re-subscribe to the current Single if the given predicate returns true when the Single fails * with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param predicate the predicate called with the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(Predicate<? super Throwable> predicate) { return toSingle(toFlowable().retry(predicate)); }
@SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Single<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) { return toSingle(Flowable.<T>fromFuture(future, timeout, unit, scheduler));
/** * Re-subscribe to the current Single if the given predicate returns true when the Single fails * with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param predicate the predicate called with the resubscription count and the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(BiPredicate<? super Integer, ? super Throwable> predicate) { return toSingle(toFlowable().retry(predicate)); }
/** * Repeatedly re-subscribe at most times or until the predicate returns false, whichever happens first * if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * <p>History: 2.1.8 - experimental * @param times the number of times to resubscribe if the current Single fails * @param predicate the predicate called with the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.2 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(long times, Predicate<? super Throwable> predicate) { return toSingle(toFlowable().retry(times, predicate)); }
/** * Repeatedly re-subscribes to the current Single indefinitely if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry() { return toSingle(toFlowable().retry()); }
/** * Converts a {@link Future}, operating on a specified {@link Scheduler}, into a {@code Single}. * <p> * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.from.Future.s.png" alt=""> * <p> * You can convert any object that supports the {@link Future} interface into a {@code Single} that emits * the return value of the {@link Future#get} method of that object, by passing the object into the * {@code from} method. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>You specify which {@link Scheduler} this operator will use.</dd> * </dl> * * @param future * the source {@link Future} * @param scheduler * the {@link Scheduler} to wait for the Future on. Use a Scheduler such as * {@link Schedulers#io()} that can block and wait on the Future * @param <T> * the type of object that the {@link Future} returns, and also the type of item to be emitted by * the resulting {@code Single} * @return a {@code Single} that emits the item from the source {@link Future} * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Single<T> fromFuture(Future<? extends T> future, Scheduler scheduler) { return toSingle(Flowable.<T>fromFuture(future, scheduler)); }
/** * Re-subscribe to the current Single if the given predicate returns true when the Single fails * with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param predicate the predicate called with the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(Predicate<? super Throwable> predicate) { return toSingle(toFlowable().retry(predicate)); }
@SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retryWhen(Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler) { return toSingle(toFlowable().retryWhen(handler));
/** * Converts a {@link Future} into a {@code Single}. * <p> * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.from.Future.png" alt=""> * <p> * You can convert any object that supports the {@link Future} interface into a Single that emits the return * value of the {@link Future#get} method of that object, by passing the object into the {@code from} * method. * <p> * <em>Important note:</em> This Single is blocking; you cannot dispose it. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param future * the source {@link Future} * @param <T> * the type of object that the {@link Future} returns, and also the type of item to be emitted by * the resulting {@code Single} * @return a {@code Single} that emits the item from the source {@link Future} * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromFuture(Future<? extends T> future) { return toSingle(Flowable.<T>fromFuture(future)); }
@SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Single<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) { return toSingle(Flowable.<T>fromFuture(future, timeout, unit, scheduler));
/** * Repeatedly re-subscribe at most the specified times to the current Single * if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param times the number of times to resubscribe if the current Single fails * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(long times) { return toSingle(toFlowable().retry(times)); }
@SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit) { return toSingle(Flowable.<T>fromFuture(future, timeout, unit));
/** * Re-subscribe to the current Single if the given predicate returns true when the Single fails * with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param predicate the predicate called with the resubscription count and the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(BiPredicate<? super Integer, ? super Throwable> predicate) { return toSingle(toFlowable().retry(predicate)); }
/** * Repeatedly re-subscribe at most times or until the predicate returns false, whichever happens first * if it fails with an onError. * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * @param times the number of times to resubscribe if the current Single fails * @param predicate the predicate called with the failure Throwable * and should return true if a resubscription should happen * @return the new Single instance * @since 2.1.8 - experimental */ @Experimental @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retry(long times, Predicate<? super Throwable> predicate) { return toSingle(toFlowable().retry(times, predicate)); }
@SchedulerSupport(SchedulerSupport.NONE) public final Single<T> retryWhen(Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler) { return toSingle(toFlowable().retryWhen(handler));