@@ -2089,95 +2089,6 @@ public static <T> Flowable<T> error(@NonNull Throwable throwable) {
20892089 return RxJavaPlugins.onAssembly(new FlowableFromFuture<>(future, timeout, unit));
20902090 }
20912091
2092- /**
2093- * Converts a {@link Future} into a {@link Publisher}, with a timeout on the {@code Future}.
2094- * <p>
2095- * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/from.Future.png" alt="">
2096- * <p>
2097- * You can convert any object that supports the {@code Future} interface into a {@code Publisher} that emits the
2098- * return value of the {@link Future#get} method of that object by passing the object into the {@code from}
2099- * method.
2100- * <p>
2101- * Unlike 1.x, canceling the {@code Flowable} won't cancel the future. If necessary, one can use composition to achieve the
2102- * cancellation effect: {@code futurePublisher.doOnCancel(() -> future.cancel(true));}.
2103- * <p>
2104- * <em>Important note:</em> This {@code Publisher} is blocking; you cannot cancel it.
2105- * <p>
2106- * Also note that this operator will consume a {@link CompletionStage}-based {@code Future} subclass (such as
2107- * {@link CompletableFuture}) in a blocking manner as well. Use the {@link #fromCompletionStage(CompletionStage)}
2108- * operator to convert and consume such sources in a non-blocking fashion instead.
2109- * <dl>
2110- * <dt><b>Backpressure:</b></dt>
2111- * <dd>The operator honors backpressure from downstream.</dd>
2112- * <dt><b>Scheduler:</b></dt>
2113- * <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd>
2114- * </dl>
2115- *
2116- * @param future
2117- * the source {@code Future}
2118- * @param timeout
2119- * the maximum time to wait before calling {@code get}
2120- * @param unit
2121- * the {@link TimeUnit} of the {@code timeout} argument
2122- * @param scheduler
2123- * the {@code Scheduler} to wait for the {@code Future} on. Use a {@code Scheduler} such as
2124- * {@link Schedulers#io()} that can block and wait on the {@code Future}
2125- * @param <T>
2126- * the type of object that the {@code Future} returns, and also the type of item to be emitted by
2127- * the resulting {@code Publisher}
2128- * @return a {@code Flowable} that emits the item from the source {@code Future}
2129- * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
2130- * @see #fromCompletionStage(CompletionStage)
2131- */
2132- @SuppressWarnings({ "unchecked" })
2133- @CheckReturnValue
2134- @NonNull
2135- @BackpressureSupport(BackpressureKind.FULL)
2136- @SchedulerSupport(SchedulerSupport.CUSTOM)
2137- public static <@NonNull T> Flowable<T> fromFuture(Future<? extends T> future, long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
2138- Objects.requireNonNull(scheduler, "scheduler is null");
2139- return fromFuture((Future<T>)future, timeout, unit).subscribeOn(scheduler);
2140- }
2141-
2142- /**
2143- * Converts a {@link Future}, operating on a specified {@link Scheduler}, into a {@link Publisher}.
2144- * <p>
2145- * <img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/from.Future.s.png" alt="">
2146- * <p>
2147- * You can convert any object that supports the {@code Future} interface into a {@code Publisher} that emits the
2148- * return value of the {@link Future#get} method of that object by passing the object into the {@code from}
2149- * method.
2150- * <p>
2151- * Unlike 1.x, canceling the {@code Flowable} won't cancel the future. If necessary, one can use composition to achieve the
2152- * cancellation effect: {@code futurePublisher.doOnCancel(() -> future.cancel(true));}.
2153- * <dl>
2154- * <dt><b>Backpressure:</b></dt>
2155- * <dd>The operator honors backpressure from downstream.</dd>
2156- * <dt><b>Scheduler:</b></dt>
2157- * <dd>You specify which {@code Scheduler} this operator will use.</dd>
2158- * </dl>
2159- *
2160- * @param future
2161- * the source {@code Future}
2162- * @param scheduler
2163- * the {@code Scheduler} to wait for the {@code Future} on. Use a {@code Scheduler} such as
2164- * {@link Schedulers#io()} that can block and wait on the {@code Future}
2165- * @param <T>
2166- * the type of object that the {@code Future} returns, and also the type of item to be emitted by
2167- * the resulting {@code Publisher}
2168- * @return a {@code Flowable} that emits the item from the source {@code Future}
2169- * @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
2170- */
2171- @SuppressWarnings({ "unchecked" })
2172- @CheckReturnValue
2173- @NonNull
2174- @BackpressureSupport(BackpressureKind.FULL)
2175- @SchedulerSupport(SchedulerSupport.CUSTOM)
2176- public static <@NonNull T> Flowable<T> fromFuture(Future<? extends T> future, @NonNull Scheduler scheduler) {
2177- Objects.requireNonNull(scheduler, "scheduler is null");
2178- return fromFuture((Future<T>)future).subscribeOn(scheduler);
2179- }
2180-
21812092 /**
21822093 * Converts an {@link Iterable} sequence into a {@link Publisher} that emits the items in the sequence.
21832094 * <p>
0 commit comments