| 1 |
/* |
| 2 |
* Copyright (c) 2016-present, RxJava Contributors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See |
| 11 |
* the License for the specific language governing permissions and limitations under the License. |
| 12 |
*/ |
| 13 |
|
| 14 |
package io.reactivex.rxjava3.internal.operators.flowable; |
| 15 |
|
| 16 |
import org.reactivestreams.*; |
| 17 |
|
| 18 |
import io.reactivex.rxjava3.core.Flowable; |
| 19 |
import io.reactivex.rxjava3.functions.Function; |
| 20 |
import io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMapEager.ConcatMapEagerDelayErrorSubscriber; |
| 21 |
import io.reactivex.rxjava3.internal.util.ErrorMode; |
| 22 |
|
| 23 |
/** |
| 24 |
* ConcatMapEager which works with an arbitrary Publisher source. |
| 25 |
* <p>History: 2.0.7 - experimental |
| 26 |
* @param <T> the input value type |
| 27 |
* @param <R> the output type |
| 28 |
* @since 2.1 |
| 29 |
*/ |
| 30 |
public final class FlowableConcatMapEagerPublisher<T, R> extends Flowable<R> { |
| 31 |
|
| 32 |
final Publisher<T> source; |
| 33 |
|
| 34 |
final Function<? super T, ? extends Publisher<? extends R>> mapper; |
| 35 |
|
| 36 |
final int maxConcurrency; |
| 37 |
|
| 38 |
final int prefetch; |
| 39 |
|
| 40 |
final ErrorMode errorMode; |
| 41 |
|
| 42 |
public FlowableConcatMapEagerPublisher(Publisher<T> source, |
| 43 |
Function<? super T, ? extends Publisher<? extends R>> mapper, |
| 44 |
int maxConcurrency, |
| 45 |
int prefetch, |
| 46 |
ErrorMode errorMode) { |
| 47 |
this.source = source; |
| 48 |
this.mapper = mapper; |
| 49 |
this.maxConcurrency = maxConcurrency; |
| 50 |
this.prefetch = prefetch; |
| 51 |
this.errorMode = errorMode; |
| 52 |
} |
| 53 |
|
| 54 |
@Override |
| 55 |
protected void subscribeActual(Subscriber<? super R> s) { |
| 56 |
source.subscribe(new ConcatMapEagerDelayErrorSubscriber<>( |
| 57 |
s, mapper, maxConcurrency, prefetch, errorMode)); |
| 58 |
} |
| 59 |
} |