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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. @Test
  2. public void innerErrorDelayed() {
  3. Observable.range(1, 5)
  4. .concatMapCompletableDelayError(
  5. new Function<Integer, CompletableSource>() {
  6. @Override
  7. public CompletableSource apply(Integer v) throws Exception {
  8. return Completable.error(new TestException());
  9. }
  10. }
  11. )
  12. .test()
  13. .assertFailure(CompositeException.class)
  14. .assertOf(new Consumer<TestObserver<Void>>() {
  15. @Override
  16. public void accept(TestObserver<Void> to) throws Exception {
  17. assertEquals(5, ((CompositeException)to.errors().get(0)).getExceptions().size());
  18. }
  19. });
  20. }

相关文章

Observable类方法