io.reactivex.Observable.concatMapCompletableDelayError()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中io.reactivex.Observable.concatMapCompletableDelayError()方法的一些代码示例,展示了Observable.concatMapCompletableDelayError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.concatMapCompletableDelayError()方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:concatMapCompletableDelayError

Observable.concatMapCompletableDelayError介绍

[英]Maps the upstream items into CompletableSources and subscribes to them one after the other terminates, delaying all errors till both this Observable and all inner CompletableSources terminate.

Scheduler: concatMapCompletableDelayError does not operate by default on a particular Scheduler.
[中]将上游项映射到CompletableSource中,并一个接一个地订阅它们,将所有错误延迟到该可观察源和所有内部CompletableSource终止。
调度程序:默认情况下,concatMapCompletableDelayError不会在特定调度程序上运行。

代码示例

代码示例来源:origin: ReactiveX/RxJava

/**
 * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
 * other terminates, delaying all errors till both this {@code Observable} and all
 * inner {@code CompletableSource}s terminate.
 * <p>
 * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
 * <dl>
 *  <dt><b>Scheduler:</b></dt>
 *  <dd>{@code concatMapCompletableDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
 * </dl>
 * <p>History: 2.1.11 - experimental
 * @param mapper the function called with the upstream item and should return
 *               a {@code CompletableSource} to become the next source to
 *               be subscribed to
 * @return a new Completable instance
 * @see #concatMapCompletable(Function, int)
 * @since 2.2
 */
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatMapCompletableDelayError(Function<? super T, ? extends CompletableSource> mapper) {
  return concatMapCompletableDelayError(mapper, true, 2);
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
 * other terminates, optionally delaying all errors till both this {@code Observable} and all
 * inner {@code CompletableSource}s terminate.
 * <p>
 * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
 * <dl>
 *  <dt><b>Scheduler:</b></dt>
 *  <dd>{@code concatMapCompletableDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
 * </dl>
 * <p>History: 2.1.11 - experimental
 * @param mapper the function called with the upstream item and should return
 *               a {@code CompletableSource} to become the next source to
 *               be subscribed to
 * @param tillTheEnd If {@code true}, errors from this {@code Observable} or any of the
 *                   inner {@code CompletableSource}s are delayed until all
 *                   of them terminate. If {@code false}, an error from this
 *                   {@code Observable} is delayed until the current inner
 *                   {@code CompletableSource} terminates and only then is
 *                   it emitted to the downstream.
 * @return a new Completable instance
 * @see #concatMapCompletable(Function)
 * @since 2.2
 */
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable concatMapCompletableDelayError(Function<? super T, ? extends CompletableSource> mapper, boolean tillTheEnd) {
  return concatMapCompletableDelayError(mapper, tillTheEnd, 2);
}

代码示例来源:origin: redisson/redisson

/**
 * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
 * other terminates, delaying all errors till both this {@code Observable} and all
 * inner {@code CompletableSource}s terminate.
 * <p>
 * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
 * <dl>
 *  <dt><b>Scheduler:</b></dt>
 *  <dd>{@code concatMapCompletableDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
 * </dl>
 * @param mapper the function called with the upstream item and should return
 *               a {@code CompletableSource} to become the next source to
 *               be subscribed to
 * @return a new Completable instance
 * @since 2.1.11 - experimental
 * @see #concatMapCompletable(Function, int)
 */
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@Experimental
public final Completable concatMapCompletableDelayError(Function<? super T, ? extends CompletableSource> mapper) {
  return concatMapCompletableDelayError(mapper, true, 2);
}

代码示例来源:origin: redisson/redisson

/**
 * Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the
 * other terminates, optionally delaying all errors till both this {@code Observable} and all
 * inner {@code CompletableSource}s terminate.
 * <p>
 * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt="">
 * <dl>
 *  <dt><b>Scheduler:</b></dt>
 *  <dd>{@code concatMapCompletableDelayError} does not operate by default on a particular {@link Scheduler}.</dd>
 * </dl>
 * @param mapper the function called with the upstream item and should return
 *               a {@code CompletableSource} to become the next source to
 *               be subscribed to
 * @param tillTheEnd If {@code true}, errors from this {@code Observable} or any of the
 *                   inner {@code CompletableSource}s are delayed until all
 *                   of them terminate. If {@code false}, an error from this
 *                   {@code Observable} is delayed until the current inner
 *                   {@code CompletableSource} terminates and only then is
 *                   it emitted to the downstream.
 * @return a new Completable instance
 * @since 2.1.11 - experimental
 * @see #concatMapCompletable(Function)
 */
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@Experimental
public final Completable concatMapCompletableDelayError(Function<? super T, ? extends CompletableSource> mapper, boolean tillTheEnd) {
  return concatMapCompletableDelayError(mapper, tillTheEnd, 2);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void innerErrorDelayed() {
  Observable.range(1, 5)
  .concatMapCompletableDelayError(
      new Function<Integer, CompletableSource>() {
        @Override
        public CompletableSource apply(Integer v) throws Exception {
          return Completable.error(new TestException());
        }
      }
  )
  .test()
  .assertFailure(CompositeException.class)
  .assertOf(new Consumer<TestObserver<Void>>() {
    @Override
    public void accept(TestObserver<Void> to) throws Exception {
      assertEquals(5, ((CompositeException)to.errors().get(0)).getExceptions().size());
    }
  });
}

相关文章

Observable类方法