本文整理了Java中io.reactivex.Flowable.concatArrayEagerDelayError()
方法的一些代码示例,展示了Flowable.concatArrayEagerDelayError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.concatArrayEagerDelayError()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:concatArrayEagerDelayError
[英]Concatenates an array of Publishers eagerly into a single stream of values and delaying any errors until all sources terminate.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes. Backpressure: The operator honors backpressure from downstream. The Publishersources are expected to honor backpressure as well. If any of the source Publishers violate this, the operator will signal a MissingBackpressureException. Scheduler: This method does not operate by default on a particular Scheduler.
[中]将发布者数组连接到单个值流中,并延迟任何错误,直到所有源终止。
即时连接意味着一旦订阅者订阅,该操作员就订阅所有源发布者。运算符缓冲这些发布服务器发出的值,然后依次将其排出,在前一个发布服务器完成后再排出。背压:操作员接受来自下游的背压。预计出版商资源也将承受背压。如果任何源发布者违反此规定,操作员将发出MissingBackpressureException信号。调度程序:默认情况下,此方法不会在特定调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
/**
* Concatenates an array of {@link Publisher}s eagerly into a single stream of values
* and delaying any errors until all sources terminate.
* <p>
* <img width="640" height="358" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Flowable.concatArrayEagerDelayError.png" alt="">
* <p>
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
* source {@code Publisher}s. The operator buffers the values emitted by these {@code Publisher}s
* and then drains them in order, each one after the previous one completes.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>The operator honors backpressure from downstream. The {@code Publisher}
* sources are expected to honor backpressure as well.
* If any of the source {@code Publisher}s violate this, the operator will signal a
* {@code MissingBackpressureException}.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
* @param <T> the value type
* @param sources an array of {@code Publisher}s that need to be eagerly concatenated
* @return the new Flowable instance with the specified concatenation behavior
* @since 2.2.1 - experimental
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@BackpressureSupport(BackpressureKind.FULL)
public static <T> Flowable<T> concatArrayEagerDelayError(Publisher<? extends T>... sources) {
return concatArrayEagerDelayError(bufferSize(), bufferSize(), sources);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void arrayDelayErrorDefault() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
PublishProcessor<Integer> pp3 = PublishProcessor.create();
@SuppressWarnings("unchecked")
TestSubscriber<Integer> ts = Flowable.concatArrayEagerDelayError(pp1, pp2, pp3)
.test();
ts.assertEmpty();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
assertTrue(pp3.hasSubscribers());
pp2.onNext(2);
pp2.onComplete();
ts.assertEmpty();
pp1.onNext(1);
ts.assertValuesOnly(1);
pp1.onComplete();
ts.assertValuesOnly(1, 2);
pp3.onComplete();
ts.assertResult(1, 2);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void arrayDelayErrorMaxConcurrency() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
PublishProcessor<Integer> pp3 = PublishProcessor.create();
@SuppressWarnings("unchecked")
TestSubscriber<Integer> ts = Flowable.concatArrayEagerDelayError(2, 2, pp1, pp2, pp3)
.test();
ts.assertEmpty();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
assertFalse(pp3.hasSubscribers());
pp2.onNext(2);
pp2.onComplete();
ts.assertEmpty();
pp1.onNext(1);
ts.assertValuesOnly(1);
pp1.onComplete();
assertTrue(pp3.hasSubscribers());
ts.assertValuesOnly(1, 2);
pp3.onComplete();
ts.assertResult(1, 2);
}
代码示例来源:origin: ReactiveX/RxJava
TestSubscriber<Integer> ts = Flowable.concatArrayEagerDelayError(2, 2, pp1, pp2, pp3)
.test();
内容来源于网络,如有侵权,请联系作者删除!