本文整理了Java中io.reactivex.Flowable.concatMapEagerDelayError()
方法的一些代码示例,展示了Flowable.concatMapEagerDelayError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.concatMapEagerDelayError()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:concatMapEagerDelayError
[英]Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.
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: Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer. Scheduler: This method does not operate by default on a particular Scheduler.
[中]将一系列值映射到发布服务器,并将这些发布服务器连接到单个发布服务器。
即时连接意味着一旦订阅者订阅,该操作员就订阅所有源发布者。运算符缓冲这些发布服务器发出的值,然后依次将其排出,在前一个发布服务器完成后再排出。背压:背压向下游移动,但是,由于迫切需要,源以无界模式订阅,其值在无界缓冲区中排队。调度程序:默认情况下,此方法不会在特定调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
/**
* Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single
* Publisher.
* <p>
* 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.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources
* are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
* @param <R> the value type
* @param mapper the function that maps a sequence of values into a sequence of Publishers that will be
* eagerly concatenated
* @param tillTheEnd
* if true, all errors from the outer and inner Publisher sources are delayed until the end,
* if false, an error from the main source is signaled when the current Publisher source terminates
* @return the new Publisher instance with the specified concatenation behavior
* @since 2.0
*/
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> concatMapEagerDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper,
boolean tillTheEnd) {
return concatMapEagerDelayError(mapper, bufferSize(), bufferSize(), tillTheEnd);
}
代码示例来源:origin: ReactiveX/RxJava
@BackpressureSupport(BackpressureKind.FULL)
public static <T> Flowable<T> concatArrayEagerDelayError(int maxConcurrency, int prefetch, Publisher<? extends T>... sources) {
return fromArray(sources).concatMapEagerDelayError((Function)Functions.identity(), maxConcurrency, prefetch, true);
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normalDelayEnd() {
Flowable.range(1, 5)
.concatMapEagerDelayError(new Function<Integer, Publisher<Integer>>() {
@Override
public Publisher<Integer> apply(Integer t) {
return Flowable.range(t, 2);
}
}, true)
.test()
.assertResult(1, 2, 2, 3, 3, 4, 4, 5, 5, 6);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normalDelayBoundary() {
Flowable.range(1, 5)
.concatMapEagerDelayError(new Function<Integer, Publisher<Integer>>() {
@Override
public Publisher<Integer> apply(Integer t) {
return Flowable.range(t, 2);
}
}, false)
.test()
.assertResult(1, 2, 2, 3, 3, 4, 4, 5, 5, 6);
}
代码示例来源:origin: redisson/redisson
/**
* Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single
* Publisher.
* <p>
* 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.
* <dl>
* <dt><b>Backpressure:</b></dt>
* <dd>Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources
* are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>This method does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
* @param <R> the value type
* @param mapper the function that maps a sequence of values into a sequence of Publishers that will be
* eagerly concatenated
* @param tillTheEnd
* if true, all errors from the outer and inner Publisher sources are delayed until the end,
* if false, an error from the main source is signaled when the current Publisher source terminates
* @return the new Publisher instance with the specified concatenation behavior
* @since 2.0
*/
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> concatMapEagerDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper,
boolean tillTheEnd) {
return concatMapEagerDelayError(mapper, bufferSize(), bufferSize(), tillTheEnd);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normalDelayEndBackpressured() {
TestSubscriber<Integer> ts = Flowable.range(1, 5)
.concatMapEagerDelayError(new Function<Integer, Publisher<Integer>>() {
@Override
public Publisher<Integer> apply(Integer t) {
return Flowable.range(t, 2);
}
}, true)
.test(3);
ts.assertValues(1, 2, 2);
ts.request(1);
ts.assertValues(1, 2, 2, 3);
ts.request(1);
ts.assertValues(1, 2, 2, 3, 3);
ts.request(5);
ts.assertResult(1, 2, 2, 3, 3, 4, 4, 5, 5, 6);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normalDelayBoundaryBackpressured() {
TestSubscriber<Integer> ts = Flowable.range(1, 5)
.concatMapEagerDelayError(new Function<Integer, Publisher<Integer>>() {
@Override
public Publisher<Integer> apply(Integer t) {
return Flowable.range(t, 2);
}
}, false)
.test(3);
ts.assertValues(1, 2, 2);
ts.request(1);
ts.assertValues(1, 2, 2, 3);
ts.request(1);
ts.assertValues(1, 2, 2, 3, 3);
ts.request(5);
ts.assertResult(1, 2, 2, 3, 3, 4, 4, 5, 5, 6);
}
内容来源于网络,如有侵权,请联系作者删除!